1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 declare float @llvm.amdgcn.fma.legacy(float, float, float)
6 define void @test(ptr %p) {
8 ; CHECK-NEXT: store volatile float 1.000000e+01, ptr [[P:%.*]], align 4
9 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
10 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
11 ; CHECK-NEXT: store volatile float 0.000000e+00, ptr [[P]], align 4
12 ; CHECK-NEXT: store volatile float 0.000000e+00, ptr [[P]], align 4
13 ; CHECK-NEXT: store volatile float 0.000000e+00, ptr [[P]], align 4
14 ; CHECK-NEXT: store volatile float 0.000000e+00, ptr [[P]], align 4
15 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
16 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
17 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
18 ; CHECK-NEXT: store volatile float 4.000000e+00, ptr [[P]], align 4
19 ; CHECK-NEXT: ret void
21 %a = call float @llvm.amdgcn.fma.legacy(float +2.0, float +3.0, float +4.0)
22 store volatile float %a, ptr %p
23 %b = call float @llvm.amdgcn.fma.legacy(float +2.0, float +0.0, float +4.0)
24 store volatile float %b, ptr %p
25 %c = call float @llvm.amdgcn.fma.legacy(float +2.0, float -0.0, float +4.0)
26 store volatile float %c, ptr %p
27 %d = call float @llvm.amdgcn.fma.legacy(float +0.0, float +0.0, float -0.0)
28 store volatile float %d, ptr %p
29 %e = call float @llvm.amdgcn.fma.legacy(float +0.0, float -0.0, float -0.0)
30 store volatile float %e, ptr %p
31 %f = call float @llvm.amdgcn.fma.legacy(float -0.0, float +0.0, float -0.0)
32 store volatile float %f, ptr %p
33 %g = call float @llvm.amdgcn.fma.legacy(float -0.0, float -0.0, float -0.0)
34 store volatile float %g, ptr %p
35 %h = call float @llvm.amdgcn.fma.legacy(float +0.0, float 0x7ff0000000000000, float +4.0) ; +inf
36 store volatile float %h, ptr %p
37 %i = call float @llvm.amdgcn.fma.legacy(float 0xfff0000000000000, float +0.0, float +4.0) ; -inf
38 store volatile float %i, ptr %p
39 %j = call float @llvm.amdgcn.fma.legacy(float 0x7ff0001000000000, float -0.0, float +4.0) ; +nan
40 store volatile float %j, ptr %p
41 %k = call float @llvm.amdgcn.fma.legacy(float -0.0, float 0xfff0000100000000, float +4.0) ; -nan
42 store volatile float %k, ptr %p