1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-64
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-64
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
7 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-32
8 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
9 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-64
11 declare i32 @llvm.ppc.lwarx(ptr)
12 define dso_local signext i32 @test_lwarx(ptr readnone %a) {
13 ; CHECK-64-LABEL: test_lwarx:
14 ; CHECK-64: # %bb.0: # %entry
16 ; CHECK-64-NEXT: lwarx 3, 0, 3
17 ; CHECK-64-NEXT: #NO_APP
18 ; CHECK-64-NEXT: extsw 3, 3
21 ; CHECK-32-LABEL: test_lwarx:
22 ; CHECK-32: # %bb.0: # %entry
24 ; CHECK-32-NEXT: lwarx 3, 0, 3
25 ; CHECK-32-NEXT: #NO_APP
28 %0 = call i32 asm sideeffect "lwarx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i32) %a)
32 declare i32 @llvm.ppc.stwcx(ptr, i32)
33 define dso_local signext i32 @test_stwcx(ptr %a, i32 signext %b) {
34 ; CHECK-64-LABEL: test_stwcx:
35 ; CHECK-64: # %bb.0: # %entry
36 ; CHECK-64-NEXT: stwcx. 4, 0, 3
37 ; CHECK-64-NEXT: mfocrf 3, 128
38 ; CHECK-64-NEXT: srwi 3, 3, 28
39 ; CHECK-64-NEXT: extsw 3, 3
42 ; CHECK-32-LABEL: test_stwcx:
43 ; CHECK-32: # %bb.0: # %entry
44 ; CHECK-32-NEXT: stwcx. 4, 0, 3
45 ; CHECK-32-NEXT: mfocrf 3, 128
46 ; CHECK-32-NEXT: srwi 3, 3, 28
49 %0 = tail call i32 @llvm.ppc.stwcx(ptr %a, i32 %b)
53 declare i32 @llvm.ppc.sthcx(ptr, i32)
54 define dso_local signext i32 @test_sthcx(ptr %a, i16 signext %val) {
55 ; CHECK-64-LABEL: test_sthcx:
56 ; CHECK-64: # %bb.0: # %entry
57 ; CHECK-64-NEXT: sthcx. 4, 0, 3
58 ; CHECK-64-NEXT: mfocrf 3, 128
59 ; CHECK-64-NEXT: srwi 3, 3, 28
60 ; CHECK-64-NEXT: extsw 3, 3
63 ; CHECK-32-LABEL: test_sthcx:
64 ; CHECK-32: # %bb.0: # %entry
65 ; CHECK-32-NEXT: sthcx. 4, 0, 3
66 ; CHECK-32-NEXT: mfocrf 3, 128
67 ; CHECK-32-NEXT: srwi 3, 3, 28
70 %0 = sext i16 %val to i32
71 %1 = tail call i32 @llvm.ppc.sthcx(ptr %a, i32 %0)
75 declare i32 @llvm.ppc.stbcx(ptr, i32)
76 define signext i32 @test_stbcx(ptr %addr, i8 signext %val) {
77 ; CHECK-64-LABEL: test_stbcx:
78 ; CHECK-64: # %bb.0: # %entry
79 ; CHECK-64-NEXT: stbcx. 4, 0, 3
80 ; CHECK-64-NEXT: mfocrf 3, 128
81 ; CHECK-64-NEXT: srwi 3, 3, 28
82 ; CHECK-64-NEXT: extsw 3, 3
85 ; CHECK-32-LABEL: test_stbcx:
86 ; CHECK-32: # %bb.0: # %entry
87 ; CHECK-32-NEXT: stbcx. 4, 0, 3
88 ; CHECK-32-NEXT: mfocrf 3, 128
89 ; CHECK-32-NEXT: srwi 3, 3, 28
92 %conv = sext i8 %val to i32
93 %0 = tail call i32 @llvm.ppc.stbcx(ptr %addr, i32 %conv)
97 define dso_local signext i16 @test_lharx(ptr %a) {
98 ; CHECK-64-LABEL: test_lharx:
99 ; CHECK-64: # %bb.0: # %entry
100 ; CHECK-64-NEXT: #APP
101 ; CHECK-64-NEXT: lharx 3, 0, 3
102 ; CHECK-64-NEXT: #NO_APP
103 ; CHECK-64-NEXT: extsh 3, 3
106 ; CHECK-32-LABEL: test_lharx:
107 ; CHECK-32: # %bb.0: # %entry
108 ; CHECK-32-NEXT: #APP
109 ; CHECK-32-NEXT: lharx 3, 0, 3
110 ; CHECK-32-NEXT: #NO_APP
111 ; CHECK-32-NEXT: extsh 3, 3
114 %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i16) %a)
118 ; Function Attrs: nounwind uwtable
119 define dso_local zeroext i8 @test_lbarx(ptr %a) {
120 ; CHECK-64-LABEL: test_lbarx:
121 ; CHECK-64: # %bb.0: # %entry
122 ; CHECK-64-NEXT: #APP
123 ; CHECK-64-NEXT: lbarx 3, 0, 3
124 ; CHECK-64-NEXT: #NO_APP
125 ; CHECK-64-NEXT: clrldi 3, 3, 56
128 ; CHECK-32-LABEL: test_lbarx:
129 ; CHECK-32: # %bb.0: # %entry
130 ; CHECK-32-NEXT: #APP
131 ; CHECK-32-NEXT: lbarx 3, 0, 3
132 ; CHECK-32-NEXT: #NO_APP
133 ; CHECK-32-NEXT: clrlwi 3, 3, 24
136 %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i8) %a)