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: rlwinm 3, 3, 31, 31, 31
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
47 ; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31
50 %0 = tail call i32 @llvm.ppc.stwcx(ptr %a, i32 %b)
54 declare i32 @llvm.ppc.sthcx(ptr, i32)
55 define dso_local signext i32 @test_sthcx(ptr %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: rlwinm 3, 3, 31, 31, 31
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
69 ; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31
72 %0 = sext i16 %val to i32
73 %1 = tail call i32 @llvm.ppc.sthcx(ptr %a, i32 %0)
77 declare i32 @llvm.ppc.stbcx(ptr, i32)
78 define signext i32 @test_stbcx(ptr %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: rlwinm 3, 3, 31, 31, 31
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
92 ; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31
95 %conv = sext i8 %val to i32
96 %0 = tail call i32 @llvm.ppc.stbcx(ptr %addr, i32 %conv)
100 define dso_local signext i16 @test_lharx(ptr %a) {
101 ; CHECK-64-LABEL: test_lharx:
102 ; CHECK-64: # %bb.0: # %entry
103 ; CHECK-64-NEXT: #APP
104 ; CHECK-64-NEXT: lharx 3, 0, 3
105 ; CHECK-64-NEXT: #NO_APP
106 ; CHECK-64-NEXT: extsh 3, 3
109 ; CHECK-32-LABEL: test_lharx:
110 ; CHECK-32: # %bb.0: # %entry
111 ; CHECK-32-NEXT: #APP
112 ; CHECK-32-NEXT: lharx 3, 0, 3
113 ; CHECK-32-NEXT: #NO_APP
114 ; CHECK-32-NEXT: extsh 3, 3
117 %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i16) %a)
121 ; Function Attrs: nounwind uwtable
122 define dso_local zeroext i8 @test_lbarx(ptr %a) {
123 ; CHECK-64-LABEL: test_lbarx:
124 ; CHECK-64: # %bb.0: # %entry
125 ; CHECK-64-NEXT: #APP
126 ; CHECK-64-NEXT: lbarx 3, 0, 3
127 ; CHECK-64-NEXT: #NO_APP
128 ; CHECK-64-NEXT: clrldi 3, 3, 56
131 ; CHECK-32-LABEL: test_lbarx:
132 ; CHECK-32: # %bb.0: # %entry
133 ; CHECK-32-NEXT: #APP
134 ; CHECK-32-NEXT: lbarx 3, 0, 3
135 ; CHECK-32-NEXT: #NO_APP
136 ; CHECK-32-NEXT: clrlwi 3, 3, 24
139 %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i8) %a)