• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: asserts
2; RUN: llc -mtriple=x86_64-unknown-unknown -debug-only=isel < %s -o /dev/null 2>&1 | FileCheck %s
3
4; This tests the propagation of fast-math-flags from IR instructions to SDNodeFlags.
5
6; CHECK-LABEL: Initial selection DAG: %bb.0 'fmf_transfer:'
7
8; CHECK:         t5: f32 = fadd nsz t2, t4
9; CHECK-NEXT:    t6: f32 = fadd arcp t5, t4
10; CHECK-NEXT:    t7: f32 = fadd nnan t6, t4
11; CHECK-NEXT:    t8: f32 = fadd ninf t7, t4
12; CHECK-NEXT:    t9: f32 = fadd contract t8, t4
13; CHECK-NEXT:    t10: f32 = fadd afn t9, t4
14; CHECK-NEXT:    t11: f32 = fadd reassoc t10, t4
15; CHECK-NEXT:    t12: f32 = fadd nnan ninf nsz arcp contract afn reassoc t11, t4
16
17; CHECK: Optimized lowered selection DAG: %bb.0 'fmf_transfer:'
18
19define float @fmf_transfer(float %x, float %y) {
20  %f1 = fadd nsz float %x, %y
21  %f2 = fadd arcp float %f1, %y
22  %f3 = fadd nnan float %f2, %y
23  %f4 = fadd ninf float %f3, %y
24  %f5 = fadd contract float %f4, %y
25  %f6 = fadd afn float %f5, %y
26  %f7 = fadd reassoc float %f6, %y
27  %f8 = fadd fast float %f7, %y
28  ret float %f8
29}
30
31; CHECK-LABEL: Optimized type-legalized selection DAG: %bb.0 'fmf_setcc:'
32; CHECK: t13: i8 = setcc nnan ninf nsz arcp contract afn reassoc t2, ConstantFP:f32<0.000000e+00>, setlt:ch
33
34define float @fmf_setcc(float %x, float %y) {
35  %cmp = fcmp fast ult float %x, 0.0
36  %ret = select i1 %cmp, float %x, float %y
37  ret float %ret
38}
39
40; CHECK-LABEL: Initial selection DAG: %bb.0 'fmf_setcc_canon:'
41; CHECK: t14: i8 = setcc nnan ninf nsz arcp contract afn reassoc t2, ConstantFP:f32<0.000000e+00>, setgt:ch
42define float @fmf_setcc_canon(float %x, float %y) {
43  %cmp = fcmp fast ult float 0.0, %x
44  %ret = select i1 %cmp, float %x, float %y
45  ret float %ret
46}
47