xref: /llvm-project/llvm/test/CodeGen/PowerPC/optimize-vector.ll (revision 329b8cd3e3826822f000175ed3e3dc6084e47e57)
1c7c3d714SLei Huang; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2c7c3d714SLei Huang; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3*329b8cd3SNemanja Ivanovic; RUN:   -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
4c7c3d714SLei Huang; RUN:   FileCheck %s
5c7c3d714SLei Huang
6c7c3d714SLei Huangdefine dso_local <16 x i8> @x2(<16 x i8> noundef %x) {
7c7c3d714SLei Huang; CHECK-LABEL: x2:
8c7c3d714SLei Huang; CHECK:       # %bb.0: # %entry
9*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    vaddubm v2, v2, v2
10c7c3d714SLei Huang; CHECK-NEXT:    blr
11c7c3d714SLei Huangentry:
12c7c3d714SLei Huang  %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>
13c7c3d714SLei Huang  ret <16 x i8> %add
14c7c3d714SLei Huang}
15c7c3d714SLei Huang
16c7c3d714SLei Huangdefine dso_local <8 x i16> @x2h(<8 x i16> noundef %x) {
17c7c3d714SLei Huang; CHECK-LABEL: x2h:
18c7c3d714SLei Huang; CHECK:       # %bb.0: # %entry
19*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    vadduhm v2, v2, v2
20c7c3d714SLei Huang; CHECK-NEXT:    blr
21c7c3d714SLei Huangentry:
22c7c3d714SLei Huang  %add = shl <8 x i16> %x, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
23c7c3d714SLei Huang  ret <8 x i16> %add
24c7c3d714SLei Huang}
25c7c3d714SLei Huang
26c7c3d714SLei Huangdefine dso_local <4 x i32> @x2w(<4 x i32> noundef %x) {
27c7c3d714SLei Huang; CHECK-LABEL: x2w:
28c7c3d714SLei Huang; CHECK:       # %bb.0: # %entry
29*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    vadduwm v2, v2, v2
30c7c3d714SLei Huang; CHECK-NEXT:    blr
31c7c3d714SLei Huangentry:
32c7c3d714SLei Huang  %add = shl <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1>
33c7c3d714SLei Huang  ret <4 x i32> %add
34c7c3d714SLei Huang}
35*329b8cd3SNemanja Ivanovic
36*329b8cd3SNemanja Ivanovicdefine dso_local <2 x i64> @x2d(<2 x i64> noundef %x) {
37*329b8cd3SNemanja Ivanovic; CHECK-LABEL: x2d:
38*329b8cd3SNemanja Ivanovic; CHECK:       # %bb.0: # %entry
39*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    addis r3, r2, .LCPI3_0@toc@ha
40*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    addi r3, r3, .LCPI3_0@toc@l
41*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    lxvd2x v3, 0, r3
42*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    vsld v2, v2, v3
43*329b8cd3SNemanja Ivanovic; CHECK-NEXT:    blr
44*329b8cd3SNemanja Ivanovicentry:
45*329b8cd3SNemanja Ivanovic  %add = shl <2 x i64> %x, <i64 1, i64 1>
46*329b8cd3SNemanja Ivanovic  ret <2 x i64> %add
47*329b8cd3SNemanja Ivanovic}
48