1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s --check-prefix=LE64
3 ; RUN: llc -mtriple=powerpcle-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s --check-prefix=LE32
4 ; RUN: llc -mtriple=powerpc64-ibm-aix -mcpu=pwr7 < %s | FileCheck %s --check-prefix=BE64
5 ; RUN: llc -mtriple=powerpc-ibm-aix -mcpu=pwr7 < %s | FileCheck %s --check-prefix=BE32
7 ; To verify this doesn't crash due to array out of bound.
8 define void @pr59074(ptr %0) {
10 ; LE64: # %bb.0: # %entry
11 ; LE64-NEXT: lwz 6, 0(3)
13 ; LE64-NEXT: ld 4, 16(3)
14 ; LE64-NEXT: ld 5, 24(3)
15 ; LE64-NEXT: addi 6, 6, -12
16 ; LE64-NEXT: std 4, 16(3)
17 ; LE64-NEXT: std 5, 24(3)
18 ; LE64-NEXT: srd 6, 7, 6
20 ; LE64-NEXT: std 7, 8(3)
21 ; LE64-NEXT: std 6, 0(3)
24 ; LE32-LABEL: pr59074:
25 ; LE32: # %bb.0: # %entry
26 ; LE32-NEXT: stwu 1, -80(1)
27 ; LE32-NEXT: .cfi_def_cfa_offset 80
28 ; LE32-NEXT: lwz 4, 0(3)
29 ; LE32-NEXT: xxlxor 0, 0, 0
31 ; LE32-NEXT: addi 6, 1, 16
34 ; LE32-NEXT: xxswapd 0, 0
35 ; LE32-NEXT: addi 4, 4, -12
36 ; LE32-NEXT: rlwinm 9, 4, 29, 28, 31
37 ; LE32-NEXT: stxvd2x 0, 6, 5
38 ; LE32-NEXT: stw 7, 44(1)
39 ; LE32-NEXT: stw 7, 40(1)
40 ; LE32-NEXT: stw 7, 36(1)
41 ; LE32-NEXT: stw 8, 16(1)
42 ; LE32-NEXT: lwzux 5, 9, 6
44 ; LE32-NEXT: lwz 7, 8(9)
45 ; LE32-NEXT: nand 6, 4, 6
46 ; LE32-NEXT: lwz 8, 4(9)
47 ; LE32-NEXT: clrlwi 4, 4, 29
48 ; LE32-NEXT: lwz 9, 12(9)
49 ; LE32-NEXT: clrlwi 6, 6, 27
50 ; LE32-NEXT: subfic 11, 4, 32
51 ; LE32-NEXT: srw 5, 5, 4
52 ; LE32-NEXT: slwi 10, 7, 1
53 ; LE32-NEXT: srw 7, 7, 4
54 ; LE32-NEXT: slw 6, 10, 6
55 ; LE32-NEXT: srw 10, 8, 4
56 ; LE32-NEXT: slw 8, 8, 11
57 ; LE32-NEXT: slw 11, 9, 11
58 ; LE32-NEXT: srw 4, 9, 4
59 ; LE32-NEXT: or 5, 8, 5
60 ; LE32-NEXT: or 7, 11, 7
61 ; LE32-NEXT: or 6, 10, 6
62 ; LE32-NEXT: stw 4, 12(3)
63 ; LE32-NEXT: stw 7, 8(3)
64 ; LE32-NEXT: stw 5, 0(3)
65 ; LE32-NEXT: stw 6, 4(3)
66 ; LE32-NEXT: addi 1, 1, 80
69 ; BE64-LABEL: pr59074:
70 ; BE64: # %bb.0: # %entry
71 ; BE64-NEXT: lwz 6, 12(3)
73 ; BE64-NEXT: ld 4, 24(3)
74 ; BE64-NEXT: ld 5, 16(3)
75 ; BE64-NEXT: addi 6, 6, -12
76 ; BE64-NEXT: std 4, 24(3)
77 ; BE64-NEXT: std 5, 16(3)
78 ; BE64-NEXT: srd 6, 7, 6
80 ; BE64-NEXT: std 7, 0(3)
81 ; BE64-NEXT: std 6, 8(3)
84 ; BE32-LABEL: pr59074:
85 ; BE32: # %bb.0: # %entry
86 ; BE32-NEXT: lwz 4, 12(3)
87 ; BE32-NEXT: xxlxor 0, 0, 0
88 ; BE32-NEXT: addi 5, 1, -64
91 ; BE32-NEXT: addi 8, 1, -48
93 ; BE32-NEXT: stxvw4x 0, 0, 5
94 ; BE32-NEXT: addi 4, 4, -12
95 ; BE32-NEXT: stw 6, -36(1)
96 ; BE32-NEXT: stw 7, -40(1)
97 ; BE32-NEXT: stw 7, -44(1)
98 ; BE32-NEXT: rlwinm 9, 4, 29, 28, 31
99 ; BE32-NEXT: stw 7, -48(1)
100 ; BE32-NEXT: sub 5, 8, 9
101 ; BE32-NEXT: nand 6, 4, 10
102 ; BE32-NEXT: clrlwi 4, 4, 29
103 ; BE32-NEXT: clrlwi 6, 6, 27
104 ; BE32-NEXT: lwz 7, 4(5)
105 ; BE32-NEXT: lwz 8, 8(5)
106 ; BE32-NEXT: lwz 9, 0(5)
107 ; BE32-NEXT: lwz 5, 12(5)
108 ; BE32-NEXT: slwi 10, 7, 1
109 ; BE32-NEXT: srw 11, 8, 4
110 ; BE32-NEXT: srw 7, 7, 4
111 ; BE32-NEXT: srw 5, 5, 4
112 ; BE32-NEXT: slw 6, 10, 6
113 ; BE32-NEXT: subfic 10, 4, 32
114 ; BE32-NEXT: srw 4, 9, 4
115 ; BE32-NEXT: slw 8, 8, 10
116 ; BE32-NEXT: slw 10, 9, 10
117 ; BE32-NEXT: or 6, 11, 6
118 ; BE32-NEXT: or 7, 10, 7
119 ; BE32-NEXT: or 5, 8, 5
120 ; BE32-NEXT: stw 4, 0(3)
121 ; BE32-NEXT: stw 6, 8(3)
122 ; BE32-NEXT: stw 5, 12(3)
123 ; BE32-NEXT: stw 7, 4(3)
126 %v1 = load <2 x i128>, <2 x i128>* %0
127 %v2 = insertelement <2 x i128> %v1, i128 12, i32 0
128 %v3 = sub <2 x i128> %v1, %v2
129 %v4 = lshr <2 x i128> %v2, %v3
130 store <2 x i128> %v4, <2 x i128>* %0