1 ; The strictfp version of test/CodeGen/PowerPC/cse-despit-rounding-mode.ll
2 ; With strictfp, the MachineIR optimizations need to assume that a call
3 ; can change the rounding mode and must not move/eliminate the repeated
4 ; multiply/convert instructions in this test.
5 ; RUN: llc -verify-machineinstrs --mtriple powerpc64le-unknown-linux-gnu \
6 ; RUN: -mcpu=pwr8 -ppc-asm-full-reg-names < %s | grep 'xvrdpic' | count 4
7 ; RUN: llc -verify-machineinstrs --mtriple powerpc-unknown-linux-gnu \
8 ; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names < %s | grep 'xvrdpic' | count 4
9 ; RUN: llc -verify-machineinstrs --mtriple powerpc64le-unknown-linux-gnu \
10 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s | grep 'xvrdpic' | count 4
12 ; RUN: llc -verify-machineinstrs --mtriple powerpc64le-unknown-linux-gnu \
13 ; RUN: -mcpu=pwr8 -ppc-asm-full-reg-names < %s | grep 'xvmuldp' | count 4
14 ; RUN: llc -verify-machineinstrs --mtriple powerpc-unknown-linux-gnu \
15 ; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names < %s | grep 'xvmuldp' | count 4
16 ; RUN: llc -verify-machineinstrs --mtriple powerpc64le-unknown-linux-gnu \
17 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s | grep 'xvmuldp' | count 4
18 @IndirectCallPtr = dso_local local_unnamed_addr global ptr null, align 8
20 define dso_local signext i32 @func1() local_unnamed_addr #0 {
22 tail call void @directCall() #0
23 %0 = tail call <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double> <double -9.990000e+01, double 9.990000e+01>, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
24 %vecext = extractelement <2 x double> %0, i32 0
25 %sub = tail call double @llvm.experimental.constrained.fsub.f64(double %vecext, double -9.900000e+01, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
26 %conv = tail call i32 @llvm.experimental.constrained.fptosi.i32.f64(double %sub, metadata !"fpexcept.ignore") #0
27 tail call void @directCall() #0
28 %1 = tail call <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double> <double -9.990000e+01, double 9.990000e+01>, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
29 %vecext3 = extractelement <2 x double> %1, i32 1
30 %cmp = tail call i1 @llvm.experimental.constrained.fcmp.f64(double %vecext3, double 9.900000e+01, metadata !"une", metadata !"fpexcept.ignore") #0
31 br i1 %cmp, label %if.then, label %if.end
33 if.then: ; preds = %entry
34 tail call void @exit(i32 signext 2) #0
37 if.end: ; preds = %entry
41 declare void @directCall(...) local_unnamed_addr
43 declare double @llvm.experimental.constrained.fsub.f64(double, double, metadata, metadata)
45 declare i32 @llvm.experimental.constrained.fptosi.i32.f64(double, metadata)
47 declare i1 @llvm.experimental.constrained.fcmp.f64(double, double, metadata, metadata)
49 declare void @exit(i32 signext) local_unnamed_addr
51 define dso_local signext i32 @func2() local_unnamed_addr #0 {
53 %call = tail call <2 x double> @getvector1() #0
54 %call1 = tail call <2 x double> @getvector2() #0
55 tail call void @directCall() #0
56 %mul = tail call <2 x double> @llvm.experimental.constrained.fmul.v2f64(<2 x double> %call, <2 x double> %call1, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
57 %vecext = extractelement <2 x double> %mul, i32 0
58 %cmp = tail call i1 @llvm.experimental.constrained.fcmp.f64(double %vecext, double 4.000000e+00, metadata !"oeq", metadata !"fpexcept.ignore") #0
59 br i1 %cmp, label %cleanup, label %if.end
61 if.end: ; preds = %entry
62 tail call void @directCall() #0
63 %mul10 = tail call <2 x double> @llvm.experimental.constrained.fmul.v2f64(<2 x double> %call, <2 x double> %call1, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
64 %0 = tail call i32 @llvm.ppc.vsx.xvcmpeqdp.p(i32 2, <2 x double> %mul, <2 x double> %mul10) #0
67 cleanup: ; preds = %entry, %if.end
68 %retval.0 = phi i32 [ %0, %if.end ], [ 11, %entry ]
72 declare <2 x double> @getvector1(...) local_unnamed_addr
74 declare <2 x double> @getvector2(...) local_unnamed_addr
76 declare <2 x double> @llvm.experimental.constrained.fmul.v2f64(<2 x double>, <2 x double>, metadata, metadata)
78 declare i32 @llvm.ppc.vsx.xvcmpeqdp.p(i32, <2 x double>, <2 x double>)
80 define dso_local signext i32 @func3() local_unnamed_addr #0 {
82 %0 = load ptr, ptr @IndirectCallPtr, align 8
83 tail call void %0() #0
84 %1 = tail call <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double> <double -9.990000e+01, double 9.990000e+01>, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
85 %vecext = extractelement <2 x double> %1, i32 0
86 %sub = tail call double @llvm.experimental.constrained.fsub.f64(double %vecext, double -9.900000e+01, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
87 %conv = tail call i32 @llvm.experimental.constrained.fptosi.i32.f64(double %sub, metadata !"fpexcept.ignore") #0
88 %2 = load ptr, ptr @IndirectCallPtr, align 8
89 tail call void %2() #0
90 %3 = tail call <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double> <double -9.990000e+01, double 9.990000e+01>, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
91 %vecext4 = extractelement <2 x double> %3, i32 1
92 %cmp = tail call i1 @llvm.experimental.constrained.fcmp.f64(double %vecext4, double 9.900000e+01, metadata !"une", metadata !"fpexcept.ignore") #0
93 br i1 %cmp, label %if.then, label %if.end
95 if.then: ; preds = %entry
96 tail call void @exit(i32 signext 2) #0
99 if.end: ; preds = %entry
103 define dso_local signext i32 @func4() local_unnamed_addr #0 {
105 %call = tail call <2 x double> @getvector1() #0
106 %call1 = tail call <2 x double> @getvector2() #0
107 %0 = load ptr, ptr @IndirectCallPtr, align 8
108 tail call void %0() #0
109 %mul = tail call <2 x double> @llvm.experimental.constrained.fmul.v2f64(<2 x double> %call, <2 x double> %call1, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
110 %vecext = extractelement <2 x double> %mul, i32 0
111 %cmp = tail call i1 @llvm.experimental.constrained.fcmp.f64(double %vecext, double 4.000000e+00, metadata !"oeq", metadata !"fpexcept.ignore") #0
112 br i1 %cmp, label %cleanup, label %if.end
114 if.end: ; preds = %entry
115 %1 = load ptr, ptr @IndirectCallPtr, align 8
116 tail call void %1() #0
117 %mul11 = tail call <2 x double> @llvm.experimental.constrained.fmul.v2f64(<2 x double> %call, <2 x double> %call1, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
118 %2 = tail call i32 @llvm.ppc.vsx.xvcmpeqdp.p(i32 2, <2 x double> %mul, <2 x double> %mul11) #0
121 cleanup: ; preds = %entry, %if.end
122 %retval.0 = phi i32 [ %2, %if.end ], [ 11, %entry ]
126 declare <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double>, metadata, metadata)
128 attributes #0 = { nounwind strictfp }