2018-02-27 03:36:36 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
2013-11-29 05:38:05 +08:00
|
|
|
|
2018-03-02 08:27:44 +08:00
|
|
|
define float @test(float %x) nounwind {
|
2018-02-27 03:36:36 +08:00
|
|
|
; CHECK-LABEL: @test(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP34:%.*]] = fadd float [[X:%.*]], 0.000000e+00
|
|
|
|
; CHECK-NEXT: ret float [[TMP34]]
|
2018-02-27 03:36:36 +08:00
|
|
|
;
|
2008-01-27 13:29:54 +08:00
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext float %x to double
|
|
|
|
%tmp3 = fadd double %tmp1, 0.000000e+00
|
|
|
|
%tmp34 = fptrunc double %tmp3 to float
|
|
|
|
ret float %tmp34
|
2008-01-27 13:29:54 +08:00
|
|
|
}
|
|
|
|
|
2018-03-02 08:27:44 +08:00
|
|
|
define float @test2(float %x, float %y) nounwind {
|
2018-02-27 03:36:36 +08:00
|
|
|
; CHECK-LABEL: @test2(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP56:%.*]] = fmul float [[X:%.*]], [[Y:%.*]]
|
|
|
|
; CHECK-NEXT: ret float [[TMP56]]
|
2018-02-27 03:36:36 +08:00
|
|
|
;
|
2013-11-29 05:38:05 +08:00
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext float %x to double
|
|
|
|
%tmp23 = fpext float %y to double
|
|
|
|
%tmp5 = fmul double %tmp1, %tmp23
|
|
|
|
%tmp56 = fptrunc double %tmp5 to float
|
|
|
|
ret float %tmp56
|
2013-11-29 05:38:05 +08:00
|
|
|
}
|
|
|
|
|
2018-03-02 08:27:44 +08:00
|
|
|
define float @test3(float %x, float %y) nounwind {
|
2018-02-27 03:36:36 +08:00
|
|
|
; CHECK-LABEL: @test3(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP56:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]]
|
|
|
|
; CHECK-NEXT: ret float [[TMP56]]
|
2018-02-27 03:36:36 +08:00
|
|
|
;
|
2008-01-27 13:29:54 +08:00
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext float %x to double
|
|
|
|
%tmp23 = fpext float %y to double
|
|
|
|
%tmp5 = fdiv double %tmp1, %tmp23
|
|
|
|
%tmp56 = fptrunc double %tmp5 to float
|
|
|
|
ret float %tmp56
|
2008-01-27 13:29:54 +08:00
|
|
|
}
|
|
|
|
|
2018-03-02 08:27:44 +08:00
|
|
|
define float @test4(float %x) nounwind {
|
2018-02-27 03:36:36 +08:00
|
|
|
; CHECK-LABEL: @test4(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP34:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
|
|
|
|
; CHECK-NEXT: ret float [[TMP34]]
|
2018-02-27 03:36:36 +08:00
|
|
|
;
|
2008-01-27 13:29:54 +08:00
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext float %x to double
|
|
|
|
%tmp2 = fsub double -0.000000e+00, %tmp1
|
|
|
|
%tmp34 = fptrunc double %tmp2 to float
|
|
|
|
ret float %tmp34
|
2008-01-27 13:29:54 +08:00
|
|
|
}
|
2018-02-27 03:36:37 +08:00
|
|
|
|
|
|
|
; Test with vector splat constant
|
2018-03-02 08:27:44 +08:00
|
|
|
define <2 x float> @test5(<2 x float> %x) nounwind {
|
2018-02-27 03:36:37 +08:00
|
|
|
; CHECK-LABEL: @test5(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[X:%.*]] to <2 x double>
|
2018-02-27 03:36:37 +08:00
|
|
|
; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], zeroinitializer
|
|
|
|
; CHECK-NEXT: [[TMP34:%.*]] = fptrunc <2 x double> [[TMP3]] to <2 x float>
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: ret <2 x float> [[TMP34]]
|
2018-02-27 03:36:37 +08:00
|
|
|
;
|
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext <2 x float> %x to <2 x double>
|
2018-02-27 03:36:37 +08:00
|
|
|
%tmp3 = fadd <2 x double> %tmp1, <double 0.000000e+00, double 0.000000e+00>
|
|
|
|
%tmp34 = fptrunc <2 x double> %tmp3 to <2 x float>
|
2018-03-02 08:27:44 +08:00
|
|
|
ret <2 x float> %tmp34
|
2018-02-27 03:36:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; Test with a non-splat constant
|
2018-03-02 08:27:44 +08:00
|
|
|
define <2 x float> @test6(<2 x float> %x) nounwind {
|
2018-02-27 03:36:37 +08:00
|
|
|
; CHECK-LABEL: @test6(
|
|
|
|
; CHECK-NEXT: entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[X:%.*]] to <2 x double>
|
2018-02-27 03:36:37 +08:00
|
|
|
; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], <double 0.000000e+00, double -0.000000e+00>
|
|
|
|
; CHECK-NEXT: [[TMP34:%.*]] = fptrunc <2 x double> [[TMP3]] to <2 x float>
|
2018-03-02 08:27:44 +08:00
|
|
|
; CHECK-NEXT: ret <2 x float> [[TMP34]]
|
2018-02-27 03:36:37 +08:00
|
|
|
;
|
|
|
|
entry:
|
2018-03-02 08:27:44 +08:00
|
|
|
%tmp1 = fpext <2 x float> %x to <2 x double>
|
2018-02-27 03:36:37 +08:00
|
|
|
%tmp3 = fadd <2 x double> %tmp1, <double 0.000000e+00, double -0.000000e+00>
|
|
|
|
%tmp34 = fptrunc <2 x double> %tmp3 to <2 x float>
|
2018-03-02 08:27:44 +08:00
|
|
|
ret <2 x float> %tmp34
|
2018-02-27 03:36:37 +08:00
|
|
|
}
|