1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/test/CodeGen/SystemZ/fpc-intrinsics.ll
Ulrich Weigand 3319b28944 [SystemZ] Support floating-point control register instructions
Add assembler support for instructions manipulating the FPC.

Also add codegen support via the GCC compatibility builtins:
  __builtin_s390_sfpc
  __builtin_s390_efpc

llvm-svn: 288525
2016-12-02 18:21:53 +00:00

68 lines
1.3 KiB
LLVM

; Test floating-point control register intrinsics.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
declare void @llvm.s390.sfpc(i32)
declare i32 @llvm.s390.efpc()
; SFPC.
define void @test_sfpc(i32 %fpc) {
; CHECK-LABEL: test_sfpc:
; CHECK: sfpc %r2
; CHECK: br %r14
call void @llvm.s390.sfpc(i32 %fpc)
ret void
}
; EFPC.
define i32 @test_efpc() {
; CHECK-LABEL: test_efpc:
; CHECK: efpc %r2
; CHECK: br %r14
%res = call i32 @llvm.s390.efpc()
ret i32 %res
}
; LFPC.
define void @test_lfpc1(i32 *%ptr) {
; CHECK-LABEL: test_lfpc1:
; CHECK: lfpc 0(%r2)
; CHECK: br %r14
%fpc = load i32, i32 *%ptr
call void @llvm.s390.sfpc(i32 %fpc)
ret void
}
; LFPC with offset.
define void @test_lfpc2(i32 *%ptr) {
; CHECK-LABEL: test_lfpc2:
; CHECK: lfpc 4092(%r2)
; CHECK: br %r14
%ptr1 = getelementptr i32, i32 *%ptr, i32 1023
%fpc = load i32, i32 *%ptr1
call void @llvm.s390.sfpc(i32 %fpc)
ret void
}
; STFPC.
define void @test_stfpc1(i32 *%ptr) {
; CHECK-LABEL: test_stfpc1:
; CHECK: stfpc 0(%r2)
; CHECK: br %r14
%fpc = call i32 @llvm.s390.efpc()
store i32 %fpc, i32 *%ptr
ret void
}
; STFPC with offset.
define void @test_stfpc2(i32 *%ptr) {
; CHECK-LABEL: test_stfpc2:
; CHECK: stfpc 4092(%r2)
; CHECK: br %r14
%fpc = call i32 @llvm.s390.efpc()
%ptr1 = getelementptr i32, i32 *%ptr, i32 1023
store i32 %fpc, i32 *%ptr1
ret void
}