+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
; Overflow on a float to int or int to float conversion is undefined (PR21130).
ret float %i
}
+; https://llvm.org/PR43907
+
+define float @nan_f64_trunc() {
+; CHECK-LABEL: @nan_f64_trunc(
+; CHECK-NEXT: ret float 0x7FF0000000000000
+;
+ %f = fptrunc double 0x7FF0000000000001 to float
+ ret float %f
+}
+
+define <2 x half> @nan_v2f32_trunc() {
+; CHECK-LABEL: @nan_v2f32_trunc(
+; CHECK-NEXT: ret <2 x half> <half 0xH7C00, half 0xH7C37>
+;
+ %f = fptrunc <2 x float> <float 0x7FF0000100000000, float 0x7FF0DEAD00000000> to <2 x half>
+ ret <2 x half> %f
+}