• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test proper extension of 8-bit/16-bit cmpxchg.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; CHECK-LABEL: f1
6; CHECK: crjlh
7; CHECK-NOT: llcr
8; CHECK-NOT: cr
9; CHECK: llgcr %r2, [[RES:%r[0-9]+]]
10; CHECK-NOT: llcr
11; CHECK-NOT: cr
12define zeroext i8 @f1(i8* nocapture, i8 zeroext, i8 zeroext) {
13  %cx = cmpxchg i8* %0, i8 %1, i8 %2 seq_cst seq_cst
14  %res = extractvalue { i8, i1 } %cx, 0
15  ret i8 %res
16}
17
18; CHECK-LABEL: f2
19; CHECK: crjlh
20; CHECK-NOT: llhr
21; CHECK-NOT: cr
22; CHECK: llghr %r2, [[RES:%r[0-9]+]]
23; CHECK-NOT: llhr
24; CHECK-NOT: cr
25define zeroext i16 @f2(i16* nocapture, i16 zeroext, i16 zeroext) {
26  %cx = cmpxchg i16* %0, i16 %1, i16 %2 seq_cst seq_cst
27  %res = extractvalue { i16, i1 } %cx, 0
28  ret i16 %res
29}
30
31; CHECK-LABEL: f3
32; CHECK: crjlh
33; CHECK-NOT: llcr
34; CHECK-NOT: cr
35; CHECK: lgbr %r2, [[RES:%r[0-9]+]]
36; CHECK-NOT: llcr
37; CHECK-NOT: cr
38define signext i8 @f3(i8* nocapture, i8 signext, i8 signext) {
39  %cx = cmpxchg i8* %0, i8 %1, i8 %2 seq_cst seq_cst
40  %res = extractvalue { i8, i1 } %cx, 0
41  ret i8 %res
42}
43
44; CHECK-LABEL: f4
45; CHECK: crjlh
46; CHECK-NOT: llhr
47; CHECK-NOT: cr
48; CHECK: lghr %r2, [[RES:%r[0-9]+]]
49; CHECK-NOT: llhr
50; CHECK-NOT: cr
51define signext i16 @f4(i16* nocapture, i16 signext, i16 signext) {
52  %cx = cmpxchg i16* %0, i16 %1, i16 %2 seq_cst seq_cst
53  %res = extractvalue { i16, i1 } %cx, 0
54  ret i16 %res
55}
56
57