ret float %r
}
+define <2 x float> @fsub_nan_op1_vec(<2 x float> %x) {
+; CHECK-LABEL: @fsub_nan_op1_vec(
+; CHECK-NEXT: ret <2 x float> <float 0x7FF1000000000000, float 0xFFF1000000000000>
+;
+ %r = fsub <2 x float> %x, <float 0x7FF1000000000000, float 0xFFF1000000000000>
+ ret <2 x float> %r
+}
+
; Signaling and signed - make quiet and preserve the payload and signbit
define double @fmul_nan_op0(double %x) {
ret double %r
}
+define <2 x double> @fmul_nan_op0_vec(<2 x double> %x) {
+; CHECK-LABEL: @fmul_nan_op0_vec(
+; CHECK-NEXT: ret <2 x double> <double 0xFFF0000000000001, double 0xFFF0DEADDEADDEAD>
+;
+ %r = fmul <2 x double> <double 0xFFF0000000000001, double 0xFFF0DEADDEADDEAD>, %x
+ ret <2 x double> %r
+}
+
; Vector type
define <2 x float> @fmul_nan_op1(<2 x float> %x) {
ret float %add
}
+; FIXME: Exceptions are ignored, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
+
+define <2 x float> @fold_fadd_vec_snan_variable_ebignore(<2 x float> %x) #0 {
+; CHECK-LABEL: @fold_fadd_vec_snan_variable_ebignore(
+; CHECK-NEXT: ret <2 x float> <float 0x7FF4000000000000, float 0xFFF4000000000000>
+;
+ %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0x7ff4000000000000, float 0xfff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
+ ret <2 x float> %add
+}
+
+; FIXME: Exceptions may (not) trap, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
+
+define <2 x float> @fold_fadd_vec_snan_variable_ebmaytrap(<2 x float> %x) #0 {
+; CHECK-LABEL: @fold_fadd_vec_snan_variable_ebmaytrap(
+; CHECK-NEXT: ret <2 x float> <float 0xFFF4000000000000, float 0x7FF4000000000000>
+;
+ %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0xfff4000000000000, float 0x7ff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
+ ret <2 x float> %add
+}
+
+; FIXME: Exceptions are ignored, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
+
+define <2 x float> @fold_fadd_vec_partial_snan_variable_ebignore(<2 x float> %x) #0 {
+; CHECK-LABEL: @fold_fadd_vec_partial_snan_variable_ebignore(
+; CHECK-NEXT: ret <2 x float> <float 0x7FF4000000000000, float 0xFFFF000000000000>
+;
+ %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0x7ff4000000000000, float 0xffff000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
+ ret <2 x float> %add
+}
+
+; FIXME: Exceptions may (not) trap, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
+
+define <2 x float> @fold_fadd_vec_partial_snan_variable_ebmaytrap(<2 x float> %x) #0 {
+; CHECK-LABEL: @fold_fadd_vec_partial_snan_variable_ebmaytrap(
+; CHECK-NEXT: ret <2 x float> <float 0xFFF8000000000000, float 0x7FF4000000000000>
+;
+ %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0xfff8000000000000, float 0x7ff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
+ ret <2 x float> %add
+}
+
define float @fold_fadd_snan_variable_ebstrict(float %x) #0 {
; CHECK-LABEL: @fold_fadd_snan_variable_ebstrict(
; CHECK-NEXT: [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float [[X:%.*]], metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]