• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4declare half @llvm.amdgcn.fract.f16(half)
5declare float @llvm.amdgcn.fract.f32(float)
6declare double @llvm.amdgcn.fract.f64(double)
7
8define void @test_f16(half* %p) {
9; CHECK-LABEL: @test_f16(
10; CHECK-NEXT:    store volatile half 0xH0000, half* [[P:%.*]]
11; CHECK-NEXT:    store volatile half 0xH0000, half* [[P]]
12; CHECK-NEXT:    store volatile half 0xH0000, half* [[P]]
13; CHECK-NEXT:    store volatile half 0xH0000, half* [[P]]
14; CHECK-NEXT:    store volatile half 0xH3400, half* [[P]]
15; CHECK-NEXT:    store volatile half 0xH3B00, half* [[P]]
16; CHECK-NEXT:    store volatile half 0xH0400, half* [[P]]
17; CHECK-NEXT:    store volatile half 0xH3BFF, half* [[P]]
18; CHECK-NEXT:    store volatile half 0xH7E00, half* [[P]]
19; CHECK-NEXT:    store volatile half 0xH7E00, half* [[P]]
20; CHECK-NEXT:    store volatile half 0xH7E00, half* [[P]]
21; CHECK-NEXT:    ret void
22;
23  %p0 = call half @llvm.amdgcn.fract.f16(half +0.0)
24  store volatile half %p0, half* %p
25  %n0 = call half @llvm.amdgcn.fract.f16(half -0.0)
26  store volatile half %n0, half* %p
27  %p1 = call half @llvm.amdgcn.fract.f16(half +1.0)
28  store volatile half %p1, half* %p
29  %n1 = call half @llvm.amdgcn.fract.f16(half -1.0)
30  store volatile half %n1, half* %p
31  %p225 = call half @llvm.amdgcn.fract.f16(half +2.25)
32  store volatile half %p225, half* %p
33  %n6125 = call half @llvm.amdgcn.fract.f16(half -6.125)
34  store volatile half %n6125, half* %p
35  %ptiny = call half @llvm.amdgcn.fract.f16(half 0xH0400) ; +min normal
36  store volatile half %ptiny, half* %p
37  %ntiny = call half @llvm.amdgcn.fract.f16(half 0xH8400) ; -min normal
38  store volatile half %ntiny, half* %p
39  %pinf = call half @llvm.amdgcn.fract.f16(half 0xH7C00) ; +inf
40  store volatile half %pinf, half* %p
41  %ninf = call half @llvm.amdgcn.fract.f16(half 0xHFC00) ; -inf
42  store volatile half %ninf, half* %p
43  %nan = call half @llvm.amdgcn.fract.f16(half 0xH7E00) ; nan
44  store volatile half %nan, half* %p
45  ret void
46}
47
48define void @test_f32(float* %p) {
49; CHECK-LABEL: @test_f32(
50; CHECK-NEXT:    store volatile float 0.000000e+00, float* [[P:%.*]]
51; CHECK-NEXT:    store volatile float 0.000000e+00, float* [[P]]
52; CHECK-NEXT:    store volatile float 0.000000e+00, float* [[P]]
53; CHECK-NEXT:    store volatile float 0.000000e+00, float* [[P]]
54; CHECK-NEXT:    store volatile float 2.500000e-01, float* [[P]]
55; CHECK-NEXT:    store volatile float 8.750000e-01, float* [[P]]
56; CHECK-NEXT:    store volatile float 0x3810000000000000, float* [[P]]
57; CHECK-NEXT:    store volatile float 0x3FEFFFFFE0000000, float* [[P]]
58; CHECK-NEXT:    store volatile float 0x7FF8000000000000, float* [[P]]
59; CHECK-NEXT:    store volatile float 0x7FF8000000000000, float* [[P]]
60; CHECK-NEXT:    store volatile float 0x7FF8000000000000, float* [[P]]
61; CHECK-NEXT:    ret void
62;
63  %p0 = call float @llvm.amdgcn.fract.f32(float +0.0)
64  store volatile float %p0, float* %p
65  %n0 = call float @llvm.amdgcn.fract.f32(float -0.0)
66  store volatile float %n0, float* %p
67  %p1 = call float @llvm.amdgcn.fract.f32(float +1.0)
68  store volatile float %p1, float* %p
69  %n1 = call float @llvm.amdgcn.fract.f32(float -1.0)
70  store volatile float %n1, float* %p
71  %p225 = call float @llvm.amdgcn.fract.f32(float +2.25)
72  store volatile float %p225, float* %p
73  %n6125 = call float @llvm.amdgcn.fract.f32(float -6.125)
74  store volatile float %n6125, float* %p
75  %ptiny = call float @llvm.amdgcn.fract.f32(float 0x3810000000000000) ; +min normal
76  store volatile float %ptiny, float* %p
77  %ntiny = call float @llvm.amdgcn.fract.f32(float 0xB810000000000000) ; -min normal
78  store volatile float %ntiny, float* %p
79  %pinf = call float @llvm.amdgcn.fract.f32(float 0x7FF0000000000000) ; +inf
80  store volatile float %pinf, float* %p
81  %ninf = call float @llvm.amdgcn.fract.f32(float 0xFFF0000000000000) ; -inf
82  store volatile float %ninf, float* %p
83  %nan = call float @llvm.amdgcn.fract.f32(float 0x7FF8000000000000) ; nan
84  store volatile float %nan, float* %p
85  ret void
86}
87
88define void @test_f64(double* %p) {
89; CHECK-LABEL: @test_f64(
90; CHECK-NEXT:    store volatile double 0.000000e+00, double* [[P:%.*]]
91; CHECK-NEXT:    store volatile double 0.000000e+00, double* [[P]]
92; CHECK-NEXT:    store volatile double 0.000000e+00, double* [[P]]
93; CHECK-NEXT:    store volatile double 0.000000e+00, double* [[P]]
94; CHECK-NEXT:    store volatile double 2.500000e-01, double* [[P]]
95; CHECK-NEXT:    store volatile double 8.750000e-01, double* [[P]]
96; CHECK-NEXT:    store volatile double 2.000000e-308, double* [[P]]
97; CHECK-NEXT:    store volatile double 0x3FEFFFFFFFFFFFFF, double* [[P]]
98; CHECK-NEXT:    store volatile double 0x7FF8000000000000, double* [[P]]
99; CHECK-NEXT:    store volatile double 0x7FF8000000000000, double* [[P]]
100; CHECK-NEXT:    store volatile double 0x7FF8000000000000, double* [[P]]
101; CHECK-NEXT:    ret void
102;
103  %p0 = call double @llvm.amdgcn.fract.f64(double +0.0)
104  store volatile double %p0, double* %p
105  %n0 = call double @llvm.amdgcn.fract.f64(double -0.0)
106  store volatile double %n0, double* %p
107  %p1 = call double @llvm.amdgcn.fract.f64(double +1.0)
108  store volatile double %p1, double* %p
109  %n1 = call double @llvm.amdgcn.fract.f64(double -1.0)
110  store volatile double %n1, double* %p
111  %p225 = call double @llvm.amdgcn.fract.f64(double +2.25)
112  store volatile double %p225, double* %p
113  %n6125 = call double @llvm.amdgcn.fract.f64(double -6.125)
114  store volatile double %n6125, double* %p
115  %ptiny = call double @llvm.amdgcn.fract.f64(double +2.0e-308) ; +min normal
116  store volatile double %ptiny, double* %p
117  %ntiny = call double @llvm.amdgcn.fract.f64(double -2.0e-308) ; -min normal
118  store volatile double %ntiny, double* %p
119  %pinf = call double @llvm.amdgcn.fract.f64(double 0x7FF0000000000000) ; +inf
120  store volatile double %pinf, double* %p
121  %ninf = call double @llvm.amdgcn.fract.f64(double 0xFFF0000000000000) ; -inf
122  store volatile double %ninf, double* %p
123  %nan = call double @llvm.amdgcn.fract.f64(double 0x7FF8000000000000) ; nan
124  store volatile double %nan, double* %p
125  ret void
126}
127