[llvm] r334107 - [ConstProp] move tests for fp <--> int; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 09:53:57 PDT 2018
Author: spatel
Date: Wed Jun 6 09:53:56 2018
New Revision: 334107
URL: http://llvm.org/viewvc/llvm-project?rev=334107&view=rev
Log:
[ConstProp] move tests for fp <--> int; NFC
These were added for D5603 / rL219542, and there's a proposal to
change one side in D47807.
These are tests of constant propagation, so they shouldn't have
ever been tested/housed under InstCombine.
Added:
llvm/trunk/test/Transforms/ConstProp/cast.ll
Modified:
llvm/trunk/test/Transforms/InstCombine/cast.ll
Added: llvm/trunk/test/Transforms/ConstProp/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/cast.ll?rev=334107&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ConstProp/cast.ll (added)
+++ llvm/trunk/test/Transforms/ConstProp/cast.ll Wed Jun 6 09:53:56 2018
@@ -0,0 +1,40 @@
+; RUN: opt < %s -constprop -S | FileCheck %s
+
+; Overflow on a float to int or int to float conversion is undefined (PR21130).
+
+define i8 @overflow_fptosi() {
+; CHECK-LABEL: @overflow_fptosi(
+; CHECK-NEXT: ret i8 undef
+;
+ %i = fptosi double 1.56e+02 to i8
+ ret i8 %i
+}
+
+define i8 @overflow_fptoui() {
+; CHECK-LABEL: @overflow_fptoui(
+; CHECK-NEXT: ret i8 undef
+;
+ %i = fptoui double 2.56e+02 to i8
+ ret i8 %i
+}
+
+; The maximum float is approximately 2 ** 128 which is 3.4E38.
+; The constant below is 4E38. Use a 130 bit integer to hold that
+; number; 129-bits for the value + 1 bit for the sign.
+
+define float @overflow_uitofp() {
+; CHECK-LABEL: @overflow_uitofp(
+; CHECK-NEXT: ret float undef
+;
+ %i = uitofp i130 400000000000000000000000000000000000000 to float
+ ret float %i
+}
+
+define float @overflow_sitofp() {
+; CHECK-LABEL: @overflow_sitofp(
+; CHECK-NEXT: ret float undef
+;
+ %i = sitofp i130 400000000000000000000000000000000000000 to float
+ ret float %i
+}
+
Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=334107&r1=334106&r2=334107&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast.ll Wed Jun 6 09:53:56 2018
@@ -1366,43 +1366,6 @@ define i16 @test88(i16 %v) {
ret i16 %t
}
-; Overflow on a float to int or int to float conversion is undefined (PR21130).
-
-define i8 @overflow_fptosi() {
-; CHECK-LABEL: @overflow_fptosi(
-; CHECK-NEXT: ret i8 undef
-;
- %i = fptosi double 1.56e+02 to i8
- ret i8 %i
-}
-
-define i8 @overflow_fptoui() {
-; CHECK-LABEL: @overflow_fptoui(
-; CHECK-NEXT: ret i8 undef
-;
- %i = fptoui double 2.56e+02 to i8
- ret i8 %i
-}
-
-; The maximum float is approximately 2 ** 128 which is 3.4E38.
-; The constant below is 4E38. Use a 130 bit integer to hold that
-; number; 129-bits for the value + 1 bit for the sign.
-define float @overflow_uitofp() {
-; CHECK-LABEL: @overflow_uitofp(
-; CHECK-NEXT: ret float undef
-;
- %i = uitofp i130 400000000000000000000000000000000000000 to float
- ret float %i
-}
-
-define float @overflow_sitofp() {
-; CHECK-LABEL: @overflow_sitofp(
-; CHECK-NEXT: ret float undef
-;
- %i = sitofp i130 400000000000000000000000000000000000000 to float
- ret float %i
-}
-
define i32 @PR21388(i32* %v) {
; CHECK-LABEL: @PR21388(
; CHECK-NEXT: [[ICMP:%.*]] = icmp slt i32* %v, null
More information about the llvm-commits
mailing list