Home | History | Annotate | Download | only in SystemZ
      1 ; Test 32-bit atomic XORs.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
      4 
      5 ; Check XORs of a variable.
      6 define i32 @f1(i32 %dummy, i32 *%src, i32 %b) {
      7 ; CHECK-LABEL: f1:
      8 ; CHECK: l %r2, 0(%r3)
      9 ; CHECK: [[LABEL:\.[^ ]*]]:
     10 ; CHECK: lr %r0, %r2
     11 ; CHECK: xr %r0, %r4
     12 ; CHECK: cs %r2, %r0, 0(%r3)
     13 ; CHECK: jl [[LABEL]]
     14 ; CHECK: br %r14
     15   %res = atomicrmw xor i32 *%src, i32 %b seq_cst
     16   ret i32 %res
     17 }
     18 
     19 ; Check the lowest useful constant.
     20 define i32 @f2(i32 %dummy, i32 *%src) {
     21 ; CHECK-LABEL: f2:
     22 ; CHECK: l %r2, 0(%r3)
     23 ; CHECK: [[LABEL:\.[^ ]*]]:
     24 ; CHECK: lr %r0, %r2
     25 ; CHECK: xilf %r0, 1
     26 ; CHECK: cs %r2, %r0, 0(%r3)
     27 ; CHECK: jl [[LABEL]]
     28 ; CHECK: br %r14
     29   %res = atomicrmw xor i32 *%src, i32 1 seq_cst
     30   ret i32 %res
     31 }
     32 
     33 ; Check an arbitrary constant.
     34 define i32 @f3(i32 %dummy, i32 *%src) {
     35 ; CHECK-LABEL: f3:
     36 ; CHECK: xilf %r0, 3000000000
     37 ; CHECK: br %r14
     38   %res = atomicrmw xor i32 *%src, i32 3000000000 seq_cst
     39   ret i32 %res
     40 }
     41 
     42 ; Check bitwise negation.
     43 define i32 @f4(i32 %dummy, i32 *%src) {
     44 ; CHECK-LABEL: f4:
     45 ; CHECK: xilf %r0, 4294967295
     46 ; CHECK: br %r14
     47   %res = atomicrmw xor i32 *%src, i32 -1 seq_cst
     48   ret i32 %res
     49 }
     50