Use update_test_checks.py to auto-generate check lines

This commit is contained in:
Serge Pavlov 2021-07-16 18:19:31 +07:00
parent e4b79a542e
commit a0b4f424f5
1 changed files with 113 additions and 111 deletions

View File

@ -1,235 +1,237 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
; Verify that floor(10.1) is folded to 10.0 when the exception behavior is 'ignore'.
define double @floor_01() #0 {
; CHECK-LABEL: @floor_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.floor.f64(
double 1.010000e+01,
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.floor.f64(double 1.010000e+01, metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @floor_01
; CHECK: ret double 1.000000e+01
}
; Verify that floor(-10.1) is folded to -11.0 when the exception behavior is not 'ignore'.
define double @floor_02() #0 {
; CHECK-LABEL: @floor_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.floor.f64(double -1.010000e+01, metadata !"fpexcept.strict") #[[ATTR0:[0-9]+]]
; CHECK-NEXT: ret double -1.100000e+01
;
entry:
%result = call double @llvm.experimental.constrained.floor.f64(
double -1.010000e+01,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.floor.f64(double -1.010000e+01, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @floor_02
; CHECK: ret double -1.100000e+01
}
; Verify that ceil(10.1) is folded to 11.0 when the exception behavior is 'ignore'.
define double @ceil_01() #0 {
; CHECK-LABEL: @ceil_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.100000e+01
;
entry:
%result = call double @llvm.experimental.constrained.ceil.f64(
double 1.010000e+01,
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.ceil.f64(double 1.010000e+01, metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @ceil_01
; CHECK: ret double 1.100000e+01
}
; Verify that ceil(-10.1) is folded to -10.0 when the exception behavior is not 'ignore'.
define double @ceil_02() #0 {
; CHECK-LABEL: @ceil_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.ceil.f64(double -1.010000e+01, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double -1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.ceil.f64(
double -1.010000e+01,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.ceil.f64(double -1.010000e+01, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @ceil_02
; CHECK: ret double -1.000000e+01
}
; Verify that trunc(10.1) is folded to 10.0 when the exception behavior is 'ignore'.
define double @trunc_01() #0 {
; CHECK-LABEL: @trunc_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double 1.010000e+01,
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double 1.010000e+01, metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @trunc_01
; CHECK: ret double 1.000000e+01
}
; Verify that trunc(-10.1) is folded to -10.0 when the exception behavior is NOT 'ignore'.
define double @trunc_02() #0 {
; CHECK-LABEL: @trunc_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double -1.010000e+01, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double -1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double -1.010000e+01,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double -1.010000e+01, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @trunc_02
; CHECK: ret double -1.000000e+01
}
; Verify that round(10.5) is folded to 11.0 when the exception behavior is 'ignore'.
define double @round_01() #0 {
; CHECK-LABEL: @round_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.100000e+01
;
entry:
%result = call double @llvm.experimental.constrained.round.f64(
double 1.050000e+01,
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.round.f64(double 1.050000e+01, metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @round_01
; CHECK: ret double 1.100000e+01
}
; Verify that floor(-10.5) is folded to -11.0 when the exception behavior is NOT 'ignore'.
define double @round_02() #0 {
; CHECK-LABEL: @round_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.round.f64(double -1.050000e+01, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double -1.100000e+01
;
entry:
%result = call double @llvm.experimental.constrained.round.f64(
double -1.050000e+01,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.round.f64(double -1.050000e+01, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @round_02
; CHECK: ret double -1.100000e+01
}
; Verify that nearbyint(10.5) is folded to 11.0 when the rounding mode is 'upward'.
define double @nearbyint_01() #0 {
; CHECK-LABEL: @nearbyint_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.100000e+01
;
entry:
%result = call double @llvm.experimental.constrained.nearbyint.f64(
double 1.050000e+01,
metadata !"round.upward",
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.upward", metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @nearbyint_01
; CHECK: ret double 1.100000e+01
}
; Verify that nearbyint(10.5) is folded to 10.0 when the rounding mode is 'downward'.
define double @nearbyint_02() #0 {
; CHECK-LABEL: @nearbyint_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.nearbyint.f64(
double 1.050000e+01,
metadata !"round.downward",
metadata !"fpexcept.maytrap") #0
%result = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.downward", metadata !"fpexcept.maytrap") #0
ret double %result
; CHECK-LABEL: @nearbyint_02
; CHECK: ret double 1.000000e+01
}
; Verify that nearbyint(10.5) is folded to 10.0 when the rounding mode is 'towardzero'.
define double @nearbyint_03() #0 {
; CHECK-LABEL: @nearbyint_03(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.towardzero", metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.nearbyint.f64(
double 1.050000e+01,
metadata !"round.towardzero",
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.towardzero", metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nearbyint_03
; CHECK: ret double 1.000000e+01
}
; Verify that nearbyint(10.5) is folded to 10.0 when the rounding mode is 'tonearest'.
define double @nearbyint_04() #0 {
; CHECK-LABEL: @nearbyint_04(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.nearbyint.f64(
double 1.050000e+01,
metadata !"round.tonearest",
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nearbyint_04
; CHECK: ret double 1.000000e+01
}
; Verify that nearbyint(10.5) is NOT folded if the rounding mode is 'dynamic'.
define double @nearbyint_05() #0 {
; CHECK-LABEL: @nearbyint_05(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double [[RESULT]]
;
entry:
%result = call double @llvm.experimental.constrained.nearbyint.f64(
double 1.050000e+01,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.nearbyint.f64(double 1.050000e+01, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nearbyint_05
; CHECK: [[VAL:%.+]] = {{.*}}call double @llvm.experimental.constrained.nearbyint
; CHECK: ret double [[VAL]]
}
; Verify that trunc(SNAN) is NOT folded if the exception behavior mode is not 'ignore'.
define double @nonfinite_01() #0 {
; CHECK-LABEL: @nonfinite_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double 0x7FF4000000000000, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double [[RESULT]]
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double 0x7ff4000000000000,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff4000000000000, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nonfinite_01
; CHECK: [[VAL:%.+]] = {{.*}}call double @llvm.experimental.constrained.trunc
; CHECK: ret double [[VAL]]
}
; Verify that trunc(SNAN) is folded to QNAN if the exception behavior mode is 'ignore'.
define double @nonfinite_02() #0 {
; CHECK-LABEL: @nonfinite_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 0x7FF8000000000000
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double 0x7ff4000000000000,
metadata !"fpexcept.ignore") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff4000000000000, metadata !"fpexcept.ignore") #0
ret double %result
; CHECK-LABEL: @nonfinite_02
; CHECK: ret double 0x7FF8000000000000
}
; Verify that trunc(QNAN) is folded even if the exception behavior mode is not 'ignore'.
define double @nonfinite_03() #0 {
; CHECK-LABEL: @nonfinite_03(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double 0x7FF8000000000000, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double 0x7FF8000000000000
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double 0x7ff8000000000000,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff8000000000000, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nonfinite_03
; CHECK: ret double 0x7FF8000000000000
}
; Verify that trunc(+Inf) is folded even if the exception behavior mode is not 'ignore'.
define double @nonfinite_04() #0 {
; CHECK-LABEL: @nonfinite_04(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double 0x7FF0000000000000, metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double 0x7FF0000000000000
;
entry:
%result = call double @llvm.experimental.constrained.trunc.f64(
double 0x7ff0000000000000,
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff0000000000000, metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @nonfinite_04
; CHECK: ret double 0x7FF0000000000000
}
; Verify that rint(10) is folded to 10.0 when the rounding mode is 'tonearest'.
define double @rint_01() #0 {
; CHECK-LABEL: @rint_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.rint.f64(double 1.000000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.rint.f64(
double 1.000000e+01,
metadata !"round.tonearest",
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.rint.f64(double 1.000000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @rint_01
; CHECK: ret double 1.000000e+01
}
; Verify that rint(10.1) is NOT folded to 10.0 when the exception behavior is 'strict'.
define double @rint_02() #0 {
; CHECK-LABEL: @rint_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RESULT:%.*]] = call double @llvm.experimental.constrained.rint.f64(double 1.010000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
; CHECK-NEXT: ret double [[RESULT]]
;
entry:
%result = call double @llvm.experimental.constrained.rint.f64(
double 1.010000e+01,
metadata !"round.tonearest",
metadata !"fpexcept.strict") #0
%result = call double @llvm.experimental.constrained.rint.f64(double 1.010000e+01, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %result
; CHECK-LABEL: @rint_02
; CHECK: [[VAL:%.+]] = {{.*}}call double @llvm.experimental.constrained.rint
; CHECK: ret double [[VAL]]
}
; Verify that rint(10.1) is folded to 10.0 when the exception behavior is not 'strict'.
define double @rint_03() #0 {
; CHECK-LABEL: @rint_03(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret double 1.000000e+01
;
entry:
%result = call double @llvm.experimental.constrained.rint.f64(
double 1.010000e+01,
metadata !"round.tonearest",
metadata !"fpexcept.maytrap") #0
%result = call double @llvm.experimental.constrained.rint.f64(double 1.010000e+01, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
ret double %result
; CHECK-LABEL: @rint_03
; CHECK: ret double 1.000000e+01
}