1; Test 64-bit atomic XORs. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s 4 5; Check XORs of a variable. 6define i64 @f1(i64 %dummy, i64 *%src, i64 %b) { 7; CHECK-LABEL: f1: 8; CHECK: lg %r2, 0(%r3) 9; CHECK: [[LABEL:\.[^ ]*]]: 10; CHECK: lgr %r0, %r2 11; CHECK: xgr %r0, %r4 12; CHECK: csg %r2, %r0, 0(%r3) 13; CHECK: jl [[LABEL]] 14; CHECK: br %r14 15 %res = atomicrmw xor i64 *%src, i64 %b seq_cst 16 ret i64 %res 17} 18 19; Check the lowest useful XILF value. 20define i64 @f2(i64 %dummy, i64 *%src) { 21; CHECK-LABEL: f2: 22; CHECK: lg %r2, 0(%r3) 23; CHECK: [[LABEL:\.[^ ]*]]: 24; CHECK: lgr %r0, %r2 25; CHECK: xilf %r0, 1 26; CHECK: csg %r2, %r0, 0(%r3) 27; CHECK: jl [[LABEL]] 28; CHECK: br %r14 29 %res = atomicrmw xor i64 *%src, i64 1 seq_cst 30 ret i64 %res 31} 32 33; Check the high end of the XILF range. 34define i64 @f3(i64 %dummy, i64 *%src) { 35; CHECK-LABEL: f3: 36; CHECK: xilf %r0, 4294967295 37; CHECK: br %r14 38 %res = atomicrmw xor i64 *%src, i64 4294967295 seq_cst 39 ret i64 %res 40} 41 42; Check the lowest useful XIHF value, which is one greater than above. 43define i64 @f4(i64 %dummy, i64 *%src) { 44; CHECK-LABEL: f4: 45; CHECK: xihf %r0, 1 46; CHECK: br %r14 47 %res = atomicrmw xor i64 *%src, i64 4294967296 seq_cst 48 ret i64 %res 49} 50 51; Check the next value up, which must use a register. (We could use 52; combinations of XIH* and XIL* instead, but that isn't implemented.) 53define i64 @f5(i64 %dummy, i64 *%src) { 54; CHECK-LABEL: f5: 55; CHECK: xgr 56; CHECK: br %r14 57 %res = atomicrmw xor i64 *%src, i64 4294967297 seq_cst 58 ret i64 %res 59} 60 61; Check the high end of the XIHF range. 62define i64 @f6(i64 %dummy, i64 *%src) { 63; CHECK-LABEL: f6: 64; CHECK: xihf %r0, 4294967295 65; CHECK: br %r14 66 %res = atomicrmw xor i64 *%src, i64 -4294967296 seq_cst 67 ret i64 %res 68} 69 70; Check the next value up, which must use a register. 71define i64 @f7(i64 %dummy, i64 *%src) { 72; CHECK-LABEL: f7: 73; CHECK: xgr 74; CHECK: br %r14 75 %res = atomicrmw xor i64 *%src, i64 -4294967295 seq_cst 76 ret i64 %res 77} 78