1 ; RUN: opt < %s -constprop -S | FileCheck %s
3 ; Overflow on a float to int or int to float conversion is undefined (PR21130).
5 define i8 @overflow_fptosi() {
6 ; CHECK-LABEL: @overflow_fptosi(
7 ; CHECK-NEXT: ret i8 undef
9 %i = fptosi double 1.56e+02 to i8
13 define i8 @overflow_fptoui() {
14 ; CHECK-LABEL: @overflow_fptoui(
15 ; CHECK-NEXT: ret i8 undef
17 %i = fptoui double 2.56e+02 to i8
21 ; The maximum float is approximately 2 ** 128 which is 3.4E38.
22 ; The constant below is 4E38. Use a 130 bit integer to hold that
23 ; number; 129-bits for the value + 1 bit for the sign.
25 define float @overflow_uitofp() {
26 ; CHECK-LABEL: @overflow_uitofp(
27 ; CHECK-NEXT: ret float 0x7FF0000000000000
29 %i = uitofp i130 400000000000000000000000000000000000000 to float
33 define float @overflow_sitofp() {
34 ; CHECK-LABEL: @overflow_sitofp(
35 ; CHECK-NEXT: ret float 0x7FF0000000000000
37 %i = sitofp i130 400000000000000000000000000000000000000 to float