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(i8*)
12 define dso_local signext i32 @test_lwarx(i32* 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}"(i32* %a)
32 declare i32 @llvm.ppc.stwcx(i8*, i32)
33 define dso_local signext i32 @test_stwcx(i32* %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 = bitcast i32* %a to i8*
50 %1 = tail call i32 @llvm.ppc.stwcx(i8* %0, i32 %b)
54 declare i32 @llvm.ppc.sthcx(i8*, i32)
55 define dso_local signext i32 @test_sthcx(i16* %a, i16 signext %val) {
56 ; CHECK-64-LABEL: test_sthcx:
57 ; CHECK-64: # %bb.0: # %entry
58 ; CHECK-64-NEXT: sthcx. 4, 0, 3
59 ; CHECK-64-NEXT: mfocrf 3, 128
60 ; CHECK-64-NEXT: srwi 3, 3, 28
61 ; CHECK-64-NEXT: extsw 3, 3
64 ; CHECK-32-LABEL: test_sthcx:
65 ; CHECK-32: # %bb.0: # %entry
66 ; CHECK-32-NEXT: sthcx. 4, 0, 3
67 ; CHECK-32-NEXT: mfocrf 3, 128
68 ; CHECK-32-NEXT: srwi 3, 3, 28
71 %0 = bitcast i16* %a to i8*
72 %1 = sext i16 %val to i32
73 %2 = tail call i32 @llvm.ppc.sthcx(i8* %0, i32 %1)
77 declare i32 @llvm.ppc.stbcx(i8*, i32)
78 define signext i32 @test_stbcx(i8* %addr, i8 signext %val) {
79 ; CHECK-64-LABEL: test_stbcx:
80 ; CHECK-64: # %bb.0: # %entry
81 ; CHECK-64-NEXT: stbcx. 4, 0, 3
82 ; CHECK-64-NEXT: mfocrf 3, 128
83 ; CHECK-64-NEXT: srwi 3, 3, 28
84 ; CHECK-64-NEXT: extsw 3, 3
87 ; CHECK-32-LABEL: test_stbcx:
88 ; CHECK-32: # %bb.0: # %entry
89 ; CHECK-32-NEXT: stbcx. 4, 0, 3
90 ; CHECK-32-NEXT: mfocrf 3, 128
91 ; CHECK-32-NEXT: srwi 3, 3, 28
94 %conv = sext i8 %val to i32
95 %0 = tail call i32 @llvm.ppc.stbcx(i8* %addr, i32 %conv)
99 define dso_local signext i16 @test_lharx(i16* %a) {
100 ; CHECK-64-LABEL: test_lharx:
101 ; CHECK-64: # %bb.0: # %entry
102 ; CHECK-64-NEXT: #APP
103 ; CHECK-64-NEXT: lharx 3, 0, 3
104 ; CHECK-64-NEXT: #NO_APP
105 ; CHECK-64-NEXT: extsh 3, 3
108 ; CHECK-32-LABEL: test_lharx:
109 ; CHECK-32: # %bb.0: # %entry
110 ; CHECK-32-NEXT: #APP
111 ; CHECK-32-NEXT: lharx 3, 0, 3
112 ; CHECK-32-NEXT: #NO_APP
113 ; CHECK-32-NEXT: extsh 3, 3
116 %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", "=r,*Z,~{memory}"(i16* %a)
120 ; Function Attrs: nounwind uwtable
121 define dso_local zeroext i8 @test_lbarx(i8* %a) {
122 ; CHECK-64-LABEL: test_lbarx:
123 ; CHECK-64: # %bb.0: # %entry
124 ; CHECK-64-NEXT: #APP
125 ; CHECK-64-NEXT: lbarx 3, 0, 3
126 ; CHECK-64-NEXT: #NO_APP
127 ; CHECK-64-NEXT: clrldi 3, 3, 56
130 ; CHECK-32-LABEL: test_lbarx:
131 ; CHECK-32: # %bb.0: # %entry
132 ; CHECK-32-NEXT: #APP
133 ; CHECK-32-NEXT: lbarx 3, 0, 3
134 ; CHECK-32-NEXT: #NO_APP
135 ; CHECK-32-NEXT: clrlwi 3, 3, 24
138 %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(i8* %a)