[llvm] r332894 - [InstCombine] regenerate checks; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 14:09:14 PDT 2018
Author: spatel
Date: Mon May 21 14:09:14 2018
New Revision: 332894
URL: http://llvm.org/viewvc/llvm-project?rev=332894&view=rev
Log:
[InstCombine] regenerate checks; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/fpcast.ll
Modified: llvm/trunk/test/Transforms/InstCombine/fpcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fpcast.ll?rev=332894&r1=332893&r2=332894&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fpcast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fpcast.ll Mon May 21 14:09:14 2018
@@ -1,51 +1,63 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; Test some floating point casting cases
; RUN: opt < %s -instcombine -S | FileCheck %s
define i8 @test1() {
- %x = fptoui float 2.550000e+02 to i8 ; <i8> [#uses=1]
- ret i8 %x
-; CHECK: ret i8 -1
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: ret i8 -1
+;
+ %x = fptoui float 2.550000e+02 to i8
+ ret i8 %x
}
define i8 @test2() {
- %x = fptosi float -1.000000e+00 to i8 ; <i8> [#uses=1]
- ret i8 %x
-; CHECK: ret i8 -1
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: ret i8 -1
+;
+ %x = fptosi float -1.000000e+00 to i8
+ ret i8 %x
}
-; CHECK: test3
define half @test3(float %a) {
-; CHECK: fptrunc
-; CHECK: llvm.fabs.f16
+; CHECK-LABEL: @test3(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
+; CHECK-NEXT: [[C:%.*]] = call half @llvm.fabs.f16(half [[TMP1]])
+; CHECK-NEXT: ret half [[C]]
+;
%b = call float @llvm.fabs.f32(float %a)
%c = fptrunc float %b to half
ret half %c
}
-; CHECK: test4
define half @test4(float %a) {
-; CHECK: fptrunc
-; CHECK: fsub
+; CHECK-LABEL: @test4(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
+; CHECK-NEXT: [[C:%.*]] = fsub half 0xH8000, [[TMP1]]
+; CHECK-NEXT: ret half [[C]]
+;
%b = fsub float -0.0, %a
%c = fptrunc float %b to half
ret half %c
}
-; CHECK: test4-fast
define half @test4-fast(float %a) {
-; CHECK: fptrunc
-; CHECK: fsub fast
+; CHECK-LABEL: @test4-fast(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
+; CHECK-NEXT: [[C:%.*]] = fsub fast half 0xH8000, [[TMP1]]
+; CHECK-NEXT: ret half [[C]]
+;
%b = fsub fast float -0.0, %a
%c = fptrunc float %b to half
ret half %c
}
-; CHECK: test5
define half @test5(float %a, float %b, float %c) {
-; CHECK: fcmp ogt
-; CHECK: fptrunc
-; CHECK: select
-; CHECK: half 0xH3C00
+; CHECK-LABEL: @test5(
+; CHECK-NEXT: [[D:%.*]] = fcmp ogt float [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[C:%.*]] to half
+; CHECK-NEXT: [[F:%.*]] = select i1 [[D]], half [[TMP1]], half 0xH3C00
+; CHECK-NEXT: ret half [[F]]
+;
%d = fcmp ogt float %a, %b
%e = select i1 %d, float %c, float 1.0
%f = fptrunc float %e to half
@@ -55,41 +67,48 @@ define half @test5(float %a, float %b, f
declare float @llvm.fabs.f32(float) nounwind readonly
define <1 x float> @test6(<1 x double> %V) {
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: [[FREM:%.*]] = frem <1 x double> [[V:%.*]], [[V]]
+; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc <1 x double> [[FREM]] to <1 x float>
+; CHECK-NEXT: ret <1 x float> [[TRUNC]]
+;
%frem = frem <1 x double> %V, %V
%trunc = fptrunc <1 x double> %frem to <1 x float>
ret <1 x float> %trunc
-; CHECK-LABEL: @test6
-; CHECK-NEXT: %[[frem:.*]] = frem <1 x double> %V, %V
-; CHECK-NEXT: %[[trunc:.*]] = fptrunc <1 x double> %[[frem]] to <1 x float>
-; CHECK-NEXT: ret <1 x float> %trunc
}
define float @test7(double %V) {
+; CHECK-LABEL: @test7(
+; CHECK-NEXT: [[FREM:%.*]] = frem double [[V:%.*]], 1.000000e+00
+; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc double [[FREM]] to float
+; CHECK-NEXT: ret float [[TRUNC]]
+;
%frem = frem double %V, 1.000000e+00
%trunc = fptrunc double %frem to float
ret float %trunc
-; CHECK-LABEL: @test7
-; CHECK-NEXT: %[[frem:.*]] = frem double %V, 1.000000e+00
-; CHECK-NEXT: %[[trunc:.*]] = fptrunc double %frem to float
-; CHECK-NEXT: ret float %trunc
}
define float @test8(float %V) {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: [[FEXT:%.*]] = fpext float [[V:%.*]] to double
+; CHECK-NEXT: [[FREM:%.*]] = frem double [[FEXT]], 1.000000e-01
+; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc double [[FREM]] to float
+; CHECK-NEXT: ret float [[TRUNC]]
+;
%fext = fpext float %V to double
%frem = frem double %fext, 1.000000e-01
%trunc = fptrunc double %frem to float
ret float %trunc
-; CHECK-LABEL: @test8
-; CHECK-NEXT: %[[fext:.*]] = fpext float %V to double
-; CHECK-NEXT: %[[frem:.*]] = frem double %fext, 1.000000e-01
-; CHECK-NEXT: %[[trunc:.*]] = fptrunc double %frem to float
-; CHECK-NEXT: ret float %trunc
}
-; CHECK-LABEL: @test_fptrunc_fptrunc
-; CHECK-NOT: fptrunc double {{.*}} to half
define half @test_fptrunc_fptrunc(double %V) {
+; CHECK-LABEL: @test_fptrunc_fptrunc(
+; CHECK-NEXT: [[T1:%.*]] = fptrunc double [[V:%.*]] to float
+; CHECK-NEXT: [[T2:%.*]] = fptrunc float [[T1]] to half
+; CHECK-NEXT: ret half [[T2]]
+;
%t1 = fptrunc double %V to float
%t2 = fptrunc float %t1 to half
ret half %t2
}
+
More information about the llvm-commits
mailing list