diff options
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/SystemZ/fp-const-11.ll | 30 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/vec-const-05.ll | 57 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/vec-const-06.ll | 40 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/vec-const-19.ll | 18 |
4 files changed, 126 insertions, 19 deletions
diff --git a/llvm/test/CodeGen/SystemZ/fp-const-11.ll b/llvm/test/CodeGen/SystemZ/fp-const-11.ll index 8523f2786c3..ff8289d4fad 100644 --- a/llvm/test/CodeGen/SystemZ/fp-const-11.ll +++ b/llvm/test/CodeGen/SystemZ/fp-const-11.ll @@ -38,3 +38,33 @@ define void @f3(fp128 *%x) { store fp128 0xL00000000000000003fff000002000000, fp128 *%x ret void } + +; Test that VGBM works. +define void @f4(fp128 *%x) { +; CHECK-LABEL: f4: +; CHECK: vgbm %v0, 21845 +; CHECK-NEXT: vst %v0, 0(%r2) +; CHECK-NEXT: br %r14 + store fp128 0xL00ff00ff00ff00ff00ff00ff00ff00ff, fp128 *%x + ret void +} + +; Test that VREPI works. +define void @f5(fp128 *%x) { +; CHECK-LABEL: f5: +; CHECK: vrepib %v0, -8 +; CHECK-NEXT: vst %v0, 0(%r2) +; CHECK-NEXT: br %r14 + store fp128 0xLf8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8, fp128 *%x + ret void +} + +; Test that VGM works. +define void @f6(fp128 *%x) { +; CHECK-LABEL: f6: +; CHECK: vgmg %v0, 12, 31 +; CHECK-NEXT: vst %v0, 0(%r2) +; CHECK-NEXT: br %r14 + store fp128 0xL000fffff00000000000fffff00000000, fp128 *%x + ret void +} diff --git a/llvm/test/CodeGen/SystemZ/vec-const-05.ll b/llvm/test/CodeGen/SystemZ/vec-const-05.ll index 719280e9d60..55f3cdd5902 100644 --- a/llvm/test/CodeGen/SystemZ/vec-const-05.ll +++ b/llvm/test/CodeGen/SystemZ/vec-const-05.ll @@ -1,28 +1,63 @@ -; Test vector byte masks, v4f32 version. Only all-zero vectors are handled. +; Test vector byte masks, v4f32 version. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s ; Test an all-zeros vector. -define <4 x float> @f0() { -; CHECK-LABEL: f0: +define <4 x float> @f1() { +; CHECK-LABEL: f1: ; CHECK: vgbm %v24, 0 ; CHECK: br %r14 ret <4 x float> zeroinitializer } -; Test that undefs are treated as zero. -define <4 x float> @f1() { -; CHECK-LABEL: f1: -; CHECK: vgbm %v24, 0 +; Test an all-ones vector. +define <4 x float> @f2() { +; CHECK-LABEL: f2: +; CHECK: vgbm %v24, 65535 ; CHECK: br %r14 - ret <4 x float> <float zeroinitializer, float undef, - float zeroinitializer, float undef> + ret <4 x float> <float 0xffffffffe0000000, float 0xffffffffe0000000, + float 0xffffffffe0000000, float 0xffffffffe0000000> +} + +; Test a mixed vector (mask 0xc731). +define <4 x float> @f3() { +; CHECK-LABEL: f3: +; CHECK: vgbm %v24, 50993 +; CHECK: br %r14 + ret <4 x float> <float 0xffffe00000000000, float 0x381fffffe0000000, + float 0x379fffe000000000, float 0x371fe00000000000> +} + +; Test that undefs are treated as zero (mask 0xc031). +define <4 x float> @f4() { +; CHECK-LABEL: f4: +; CHECK: vgbm %v24, 49201 +; CHECK: br %r14 + ret <4 x float> <float 0xffffe00000000000, float undef, + float 0x379fffe000000000, float 0x371fe00000000000> +} + +; Test that we don't use VGBM if one of the bytes is not 0 or 0xff. +define <4 x float> @f5() { +; CHECK-LABEL: f5: +; CHECK-NOT: vgbm +; CHECK: br %r14 + ret <4 x float> <float 0xffffe00000000000, float 0x381fffffc0000000, + float 0x379fffe000000000, float 0x371fe00000000000> } ; Test an all-zeros v2f32 that gets promoted to v4f32. -define <2 x float> @f2() { -; CHECK-LABEL: f2: +define <2 x float> @f6() { +; CHECK-LABEL: f6: ; CHECK: vgbm %v24, 0 ; CHECK: br %r14 ret <2 x float> zeroinitializer } + +; Test a mixed v2f32 that gets promoted to v4f32 (mask 0xc700). +define <2 x float> @f7() { +; CHECK-LABEL: f7: +; CHECK: vgbm %v24, 50944 +; CHECK: br %r14 + ret <2 x float> <float 0xffffe00000000000, float 0x381fffffe0000000> +} diff --git a/llvm/test/CodeGen/SystemZ/vec-const-06.ll b/llvm/test/CodeGen/SystemZ/vec-const-06.ll index 6144e0f4910..be53a0581ec 100644 --- a/llvm/test/CodeGen/SystemZ/vec-const-06.ll +++ b/llvm/test/CodeGen/SystemZ/vec-const-06.ll @@ -1,19 +1,43 @@ -; Test vector byte masks, v2f64 version. Only all-zero vectors are handled. +; Test vector byte masks, v2f64 version. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s ; Test an all-zeros vector. -define <2 x double> @f0() { -; CHECK-LABEL: f0: +define <2 x double> @f1() { +; CHECK-LABEL: f1: ; CHECK: vgbm %v24, 0 ; CHECK: br %r14 ret <2 x double> zeroinitializer } -; Test that undefs are treated as zero. -define <2 x double> @f1() { -; CHECK-LABEL: f1: -; CHECK: vgbm %v24, 0 +; Test an all-ones vector. +define <2 x double> @f2() { +; CHECK-LABEL: f2: +; CHECK: vgbm %v24, 65535 +; CHECK: br %r14 + ret <2 x double> <double 0xffffffffffffffff, double 0xffffffffffffffff> +} + +; Test a mixed vector (mask 0x8c76). +define <2 x double> @f3() { +; CHECK-LABEL: f3: +; CHECK: vgbm %v24, 35958 +; CHECK: br %r14 + ret <2 x double> <double 0xff000000ffff0000, double 0x00ffffff00ffff00> +} + +; Test that undefs are treated as zero (mask 0x8c00). +define <2 x double> @f4() { +; CHECK-LABEL: f4: +; CHECK: vgbm %v24, 35840 +; CHECK: br %r14 + ret <2 x double> <double 0xff000000ffff0000, double undef> +} + +; Test that we don't use VGBM if one of the bytes is not 0 or 0xff. +define <2 x double> @f5() { +; CHECK-LABEL: f5: +; CHECK-NOT: vgbm ; CHECK: br %r14 - ret <2 x double> <double zeroinitializer, double undef> + ret <2 x double> <double 0xfe000000ffff0000, double 0x00ffffff00ffff00> } diff --git a/llvm/test/CodeGen/SystemZ/vec-const-19.ll b/llvm/test/CodeGen/SystemZ/vec-const-19.ll new file mode 100644 index 00000000000..e48bfe9250d --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/vec-const-19.ll @@ -0,0 +1,18 @@ +; Test that a scalar FP constant can be reused from a vector splat constant +; of the same value. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s + +define void @fun() { +; CHECK-LABEL: fun: +; CHECK: vgmg %v0, 2, 10 +; CHECK-NOT: vgmg %v0, 2, 10 + + %tmp = fadd <2 x double> zeroinitializer, <double 1.000000e+00, double 1.000000e+00> + %tmp1 = fmul <2 x double> %tmp, <double 5.000000e-01, double 5.000000e-01> + store <2 x double> %tmp1, <2 x double>* undef + %tmp2 = load double, double* undef + %tmp3 = fmul double %tmp2, 5.000000e-01 + store double %tmp3, double* undef + ret void +} |