diff options
| author | Dan Gohman <gohman@apple.com> | 2009-06-04 22:49:04 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-06-04 22:49:04 +0000 |
| commit | a5b9645c4b7a1d8be5e41081b99f27b49b8aa8cf (patch) | |
| tree | 7f5a9f6633be0c4e77a1bb00e5bfcfcca14e219b /llvm/test/CodeGen/CellSPU | |
| parent | 72a4d2fec138ad6d2becbc69c6d034246a056d09 (diff) | |
| download | bcm5719-llvm-a5b9645c4b7a1d8be5e41081b99f27b49b8aa8cf.tar.gz bcm5719-llvm-a5b9645c4b7a1d8be5e41081b99f27b49b8aa8cf.zip | |
Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.
For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.
This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt
llvm-svn: 72897
Diffstat (limited to 'llvm/test/CodeGen/CellSPU')
| -rw-r--r-- | llvm/test/CodeGen/CellSPU/dp_farith.ll | 48 | ||||
| -rw-r--r-- | llvm/test/CodeGen/CellSPU/fneg-fabs.ll | 8 | ||||
| -rw-r--r-- | llvm/test/CodeGen/CellSPU/sp_farith.ll | 44 |
3 files changed, 50 insertions, 50 deletions
diff --git a/llvm/test/CodeGen/CellSPU/dp_farith.ll b/llvm/test/CodeGen/CellSPU/dp_farith.ll index 2579a404eea..d4802ae8f54 100644 --- a/llvm/test/CodeGen/CellSPU/dp_farith.ll +++ b/llvm/test/CodeGen/CellSPU/dp_farith.ll @@ -11,88 +11,88 @@ target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i target triple = "spu" define double @fadd(double %arg1, double %arg2) { - %A = add double %arg1, %arg2 + %A = fadd double %arg1, %arg2 ret double %A } define <2 x double> @fadd_vec(<2 x double> %arg1, <2 x double> %arg2) { - %A = add <2 x double> %arg1, %arg2 + %A = fadd <2 x double> %arg1, %arg2 ret <2 x double> %A } define double @fsub(double %arg1, double %arg2) { - %A = sub double %arg1, %arg2 + %A = fsub double %arg1, %arg2 ret double %A } define <2 x double> @fsub_vec(<2 x double> %arg1, <2 x double> %arg2) { - %A = sub <2 x double> %arg1, %arg2 + %A = fsub <2 x double> %arg1, %arg2 ret <2 x double> %A } define double @fmul(double %arg1, double %arg2) { - %A = mul double %arg1, %arg2 + %A = fmul double %arg1, %arg2 ret double %A } define <2 x double> @fmul_vec(<2 x double> %arg1, <2 x double> %arg2) { - %A = mul <2 x double> %arg1, %arg2 + %A = fmul <2 x double> %arg1, %arg2 ret <2 x double> %A } define double @fma(double %arg1, double %arg2, double %arg3) { - %A = mul double %arg1, %arg2 - %B = add double %A, %arg3 + %A = fmul double %arg1, %arg2 + %B = fadd double %A, %arg3 ret double %B } define <2 x double> @fma_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) { - %A = mul <2 x double> %arg1, %arg2 - %B = add <2 x double> %A, %arg3 + %A = fmul <2 x double> %arg1, %arg2 + %B = fadd <2 x double> %A, %arg3 ret <2 x double> %B } define double @fms(double %arg1, double %arg2, double %arg3) { - %A = mul double %arg1, %arg2 - %B = sub double %A, %arg3 + %A = fmul double %arg1, %arg2 + %B = fsub double %A, %arg3 ret double %B } define <2 x double> @fms_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) { - %A = mul <2 x double> %arg1, %arg2 - %B = sub <2 x double> %A, %arg3 + %A = fmul <2 x double> %arg1, %arg2 + %B = fsub <2 x double> %A, %arg3 ret <2 x double> %B } ; - (a * b - c) define double @d_fnms_1(double %arg1, double %arg2, double %arg3) { - %A = mul double %arg1, %arg2 - %B = sub double %A, %arg3 - %C = sub double -0.000000e+00, %B ; <double> [#uses=1] + %A = fmul double %arg1, %arg2 + %B = fsub double %A, %arg3 + %C = fsub double -0.000000e+00, %B ; <double> [#uses=1] ret double %C } ; Annother way of getting fnms ; - ( a * b ) + c => c - (a * b) define double @d_fnms_2(double %arg1, double %arg2, double %arg3) { - %A = mul double %arg1, %arg2 - %B = sub double %arg3, %A + %A = fmul double %arg1, %arg2 + %B = fsub double %arg3, %A ret double %B } ; FNMS: - (a * b - c) => c - (a * b) define <2 x double> @d_fnms_vec_1(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) { - %A = mul <2 x double> %arg1, %arg2 - %B = sub <2 x double> %arg3, %A ; + %A = fmul <2 x double> %arg1, %arg2 + %B = fsub <2 x double> %arg3, %A ; ret <2 x double> %B } ; Another way to get fnms using a constant vector ; - ( a * b - c) define <2 x double> @d_fnms_vec_2(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) { - %A = mul <2 x double> %arg1, %arg2 ; <<2 x double>> [#uses=1] - %B = sub <2 x double> %A, %arg3 ; <<2 x double>> [#uses=1] - %C = sub <2 x double> < double -0.00000e+00, double -0.00000e+00 >, %B + %A = fmul <2 x double> %arg1, %arg2 ; <<2 x double>> [#uses=1] + %B = fsub <2 x double> %A, %arg3 ; <<2 x double>> [#uses=1] + %C = fsub <2 x double> < double -0.00000e+00, double -0.00000e+00 >, %B ret <2 x double> %C } diff --git a/llvm/test/CodeGen/CellSPU/fneg-fabs.ll b/llvm/test/CodeGen/CellSPU/fneg-fabs.ll index 4c6fbb95a39..5bd66f4aaef 100644 --- a/llvm/test/CodeGen/CellSPU/fneg-fabs.ll +++ b/llvm/test/CodeGen/CellSPU/fneg-fabs.ll @@ -7,22 +7,22 @@ target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i target triple = "spu" define double @fneg_dp(double %X) { - %Y = sub double -0.000000e+00, %X + %Y = fsub double -0.000000e+00, %X ret double %Y } define <2 x double> @fneg_dp_vec(<2 x double> %X) { - %Y = sub <2 x double> < double -0.0000e+00, double -0.0000e+00 >, %X + %Y = fsub <2 x double> < double -0.0000e+00, double -0.0000e+00 >, %X ret <2 x double> %Y } define float @fneg_sp(float %X) { - %Y = sub float -0.000000e+00, %X + %Y = fsub float -0.000000e+00, %X ret float %Y } define <4 x float> @fneg_sp_vec(<4 x float> %X) { - %Y = sub <4 x float> <float -0.000000e+00, float -0.000000e+00, + %Y = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %X ret <4 x float> %Y } diff --git a/llvm/test/CodeGen/CellSPU/sp_farith.ll b/llvm/test/CodeGen/CellSPU/sp_farith.ll index df3baef85c9..d77dd9216cd 100644 --- a/llvm/test/CodeGen/CellSPU/sp_farith.ll +++ b/llvm/test/CodeGen/CellSPU/sp_farith.ll @@ -12,79 +12,79 @@ target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i target triple = "spu" define float @fp_add(float %arg1, float %arg2) { - %A = add float %arg1, %arg2 ; <float> [#uses=1] + %A = fadd float %arg1, %arg2 ; <float> [#uses=1] ret float %A } define <4 x float> @fp_add_vec(<4 x float> %arg1, <4 x float> %arg2) { - %A = add <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %A = fadd <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] ret <4 x float> %A } define float @fp_sub(float %arg1, float %arg2) { - %A = sub float %arg1, %arg2 ; <float> [#uses=1] + %A = fsub float %arg1, %arg2 ; <float> [#uses=1] ret float %A } define <4 x float> @fp_sub_vec(<4 x float> %arg1, <4 x float> %arg2) { - %A = sub <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %A = fsub <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] ret <4 x float> %A } define float @fp_mul(float %arg1, float %arg2) { - %A = mul float %arg1, %arg2 ; <float> [#uses=1] + %A = fmul float %arg1, %arg2 ; <float> [#uses=1] ret float %A } define <4 x float> @fp_mul_vec(<4 x float> %arg1, <4 x float> %arg2) { - %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %A = fmul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] ret <4 x float> %A } define float @fp_mul_add(float %arg1, float %arg2, float %arg3) { - %A = mul float %arg1, %arg2 ; <float> [#uses=1] - %B = add float %A, %arg3 ; <float> [#uses=1] + %A = fmul float %arg1, %arg2 ; <float> [#uses=1] + %B = fadd float %A, %arg3 ; <float> [#uses=1] ret float %B } define <4 x float> @fp_mul_add_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { - %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] - %B = add <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] + %A = fmul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %B = fadd <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] ret <4 x float> %B } define float @fp_mul_sub(float %arg1, float %arg2, float %arg3) { - %A = mul float %arg1, %arg2 ; <float> [#uses=1] - %B = sub float %A, %arg3 ; <float> [#uses=1] + %A = fmul float %arg1, %arg2 ; <float> [#uses=1] + %B = fsub float %A, %arg3 ; <float> [#uses=1] ret float %B } define <4 x float> @fp_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { - %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] - %B = sub <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] + %A = fmul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %B = fsub <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] ret <4 x float> %B } ; Test the straightforward way of getting fnms ; c - a * b define float @fp_neg_mul_sub_1(float %arg1, float %arg2, float %arg3) { - %A = mul float %arg1, %arg2 - %B = sub float %arg3, %A + %A = fmul float %arg1, %arg2 + %B = fsub float %arg3, %A ret float %B } ; Test another way of getting fnms ; - ( a *b -c ) = c - a * b define float @fp_neg_mul_sub_2(float %arg1, float %arg2, float %arg3) { - %A = mul float %arg1, %arg2 - %B = sub float %A, %arg3 - %C = sub float -0.0, %B + %A = fmul float %arg1, %arg2 + %B = fsub float %A, %arg3 + %C = fsub float -0.0, %B ret float %C } define <4 x float> @fp_neg_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { - %A = mul <4 x float> %arg1, %arg2 - %B = sub <4 x float> %A, %arg3 - %D = sub <4 x float> < float -0.0, float -0.0, float -0.0, float -0.0 >, %B + %A = fmul <4 x float> %arg1, %arg2 + %B = fsub <4 x float> %A, %arg3 + %D = fsub <4 x float> < float -0.0, float -0.0, float -0.0, float -0.0 >, %B ret <4 x float> %D } |

