• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test floating-point control register intrinsics.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5declare void @llvm.s390.sfpc(i32)
6declare i32 @llvm.s390.efpc()
7
8; SFPC.
9define void @test_sfpc(i32 %fpc) {
10; CHECK-LABEL: test_sfpc:
11; CHECK: sfpc %r2
12; CHECK: br %r14
13  call void @llvm.s390.sfpc(i32 %fpc)
14  ret void
15}
16
17; EFPC.
18define i32 @test_efpc() {
19; CHECK-LABEL: test_efpc:
20; CHECK: efpc %r2
21; CHECK: br %r14
22  %res = call i32 @llvm.s390.efpc()
23  ret i32 %res
24}
25
26; LFPC.
27define void @test_lfpc1(i32 *%ptr) {
28; CHECK-LABEL: test_lfpc1:
29; CHECK: lfpc 0(%r2)
30; CHECK: br %r14
31  %fpc = load i32, i32 *%ptr
32  call void @llvm.s390.sfpc(i32 %fpc)
33  ret void
34}
35
36; LFPC with offset.
37define void @test_lfpc2(i32 *%ptr) {
38; CHECK-LABEL: test_lfpc2:
39; CHECK: lfpc 4092(%r2)
40; CHECK: br %r14
41  %ptr1 = getelementptr i32, i32 *%ptr, i32 1023
42  %fpc = load i32, i32 *%ptr1
43  call void @llvm.s390.sfpc(i32 %fpc)
44  ret void
45}
46
47; STFPC.
48define void @test_stfpc1(i32 *%ptr) {
49; CHECK-LABEL: test_stfpc1:
50; CHECK: stfpc 0(%r2)
51; CHECK: br %r14
52  %fpc = call i32 @llvm.s390.efpc()
53  store i32 %fpc, i32 *%ptr
54  ret void
55}
56
57; STFPC with offset.
58define void @test_stfpc2(i32 *%ptr) {
59; CHECK-LABEL: test_stfpc2:
60; CHECK: stfpc 4092(%r2)
61; CHECK: br %r14
62  %fpc = call i32 @llvm.s390.efpc()
63  %ptr1 = getelementptr i32, i32 *%ptr, i32 1023
64  store i32 %fpc, i32 *%ptr1
65  ret void
66}
67
68