Skip to content

Commit c6ebe3f

Browse files
committed
[InstSimplify] add tests for FP constant miscompile; NFC (PR43907)
1 parent 7f7993e commit c6ebe3f

File tree

1 file changed

+18
-0
lines changed
  • llvm/test/Transforms/InstSimplify/ConstProp

1 file changed

+18
-0
lines changed

llvm/test/Transforms/InstSimplify/ConstProp/cast.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12
; RUN: opt < %s -instsimplify -S | FileCheck %s
23

34
; Overflow on a float to int or int to float conversion is undefined (PR21130).
@@ -38,3 +39,20 @@ define float @overflow_sitofp() {
3839
ret float %i
3940
}
4041

42+
; https://llvm.org/PR43907
43+
44+
define float @nan_f64_trunc() {
45+
; CHECK-LABEL: @nan_f64_trunc(
46+
; CHECK-NEXT: ret float 0x7FF0000000000000
47+
;
48+
%f = fptrunc double 0x7FF0000000000001 to float
49+
ret float %f
50+
}
51+
52+
define <2 x half> @nan_v2f32_trunc() {
53+
; CHECK-LABEL: @nan_v2f32_trunc(
54+
; CHECK-NEXT: ret <2 x half> <half 0xH7C00, half 0xH7C37>
55+
;
56+
%f = fptrunc <2 x float> <float 0x7FF0000100000000, float 0x7FF0DEAD00000000> to <2 x half>
57+
ret <2 x half> %f
58+
}

0 commit comments

Comments
 (0)