[llvm] c7c3d71 - [PowerPC] add testcase for vector add and shift

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 4 07:45:31 PDT 2023


Author: Lei Huang
Date: 2023-07-04T10:45:19-04:00
New Revision: c7c3d71414ac250f377c067efd4848c353cec4cc

URL: https://github.com/llvm/llvm-project/commit/c7c3d71414ac250f377c067efd4848c353cec4cc
DIFF: https://github.com/llvm/llvm-project/commit/c7c3d71414ac250f377c067efd4848c353cec4cc.diff

LOG: [PowerPC] add testcase for vector add and shift

Added: 
    llvm/test/CodeGen/PowerPC/optimize-vector.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/PowerPC/optimize-vector.ll b/llvm/test/CodeGen/PowerPC/optimize-vector.ll
new file mode 100644
index 00000000000000..6a2142de09bf0d
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/optimize-vector.ll
@@ -0,0 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr7 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
+; RUN:   FileCheck %s
+
+define dso_local <16 x i8> @x2(<16 x i8> noundef %x) {
+; CHECK-LABEL: x2:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vspltisb v3, 1
+; CHECK-NEXT:    vslb v2, v2, v3
+; CHECK-NEXT:    blr
+entry:
+  %add = shl <16 x i8> %x, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
+  ret <16 x i8> %add
+}
+
+define dso_local <8 x i16> @x2h(<8 x i16> noundef %x) {
+; CHECK-LABEL: x2h:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vspltish v3, 1
+; CHECK-NEXT:    vslh v2, v2, v3
+; CHECK-NEXT:    blr
+entry:
+  %add = shl <8 x i16> %x, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
+  ret <8 x i16> %add
+}
+
+define dso_local <4 x i32> @x2w(<4 x i32> noundef %x) {
+; CHECK-LABEL: x2w:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vspltisw v3, 1
+; CHECK-NEXT:    vslw v2, v2, v3
+; CHECK-NEXT:    blr
+entry:
+  %add = shl <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1>
+  ret <4 x i32> %add
+}


        


More information about the llvm-commits mailing list