1; Test 64-bit atomic ORs. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s 4 5; Check ORs 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: ogr %r0, %r4 12; CHECK: csg %r2, %r0, 0(%r3) 13; CHECK: jl [[LABEL]] 14; CHECK: br %r14 15 %res = atomicrmw or i64 *%src, i64 %b seq_cst 16 ret i64 %res 17} 18 19; Check the lowest useful OILL 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: oill %r0, 1 26; CHECK: csg %r2, %r0, 0(%r3) 27; CHECK: jl [[LABEL]] 28; CHECK: br %r14 29 %res = atomicrmw or i64 *%src, i64 1 seq_cst 30 ret i64 %res 31} 32 33; Check the high end of the OILL range. 34define i64 @f3(i64 %dummy, i64 *%src) { 35; CHECK-LABEL: f3: 36; CHECK: oill %r0, 65535 37; CHECK: br %r14 38 %res = atomicrmw or i64 *%src, i64 65535 seq_cst 39 ret i64 %res 40} 41 42; Check the lowest useful OILH value, which is the next value up. 43define i64 @f4(i64 %dummy, i64 *%src) { 44; CHECK-LABEL: f4: 45; CHECK: oilh %r0, 1 46; CHECK: br %r14 47 %res = atomicrmw or i64 *%src, i64 65536 seq_cst 48 ret i64 %res 49} 50 51; Check the lowest useful OILF value, which is the next value up again. 52define i64 @f5(i64 %dummy, i64 *%src) { 53; CHECK-LABEL: f5: 54; CHECK: oilf %r0, 65537 55; CHECK: br %r14 56 %res = atomicrmw or i64 *%src, i64 65537 seq_cst 57 ret i64 %res 58} 59 60; Check the high end of the OILH range. 61define i64 @f6(i64 %dummy, i64 *%src) { 62; CHECK-LABEL: f6: 63; CHECK: oilh %r0, 65535 64; CHECK: br %r14 65 %res = atomicrmw or i64 *%src, i64 4294901760 seq_cst 66 ret i64 %res 67} 68 69; Check the next value up, which must use OILF. 70define i64 @f7(i64 %dummy, i64 *%src) { 71; CHECK-LABEL: f7: 72; CHECK: oilf %r0, 4294901761 73; CHECK: br %r14 74 %res = atomicrmw or i64 *%src, i64 4294901761 seq_cst 75 ret i64 %res 76} 77 78; Check the high end of the OILF range. 79define i64 @f8(i64 %dummy, i64 *%src) { 80; CHECK-LABEL: f8: 81; CHECK: oilf %r0, 4294967295 82; CHECK: br %r14 83 %res = atomicrmw or i64 *%src, i64 4294967295 seq_cst 84 ret i64 %res 85} 86 87; Check the lowest useful OIHL value, which is one greater than above. 88define i64 @f9(i64 %dummy, i64 *%src) { 89; CHECK-LABEL: f9: 90; CHECK: oihl %r0, 1 91; CHECK: br %r14 92 %res = atomicrmw or i64 *%src, i64 4294967296 seq_cst 93 ret i64 %res 94} 95 96; Check the next value up, which must use a register. (We could use 97; combinations of OIH* and OIL* instead, but that isn't implemented.) 98define i64 @f10(i64 %dummy, i64 *%src) { 99; CHECK-LABEL: f10: 100; CHECK: ogr 101; CHECK: br %r14 102 %res = atomicrmw or i64 *%src, i64 4294967297 seq_cst 103 ret i64 %res 104} 105 106; Check the high end of the OIHL range. 107define i64 @f11(i64 %dummy, i64 *%src) { 108; CHECK-LABEL: f11: 109; CHECK: oihl %r0, 65535 110; CHECK: br %r14 111 %res = atomicrmw or i64 *%src, i64 281470681743360 seq_cst 112 ret i64 %res 113} 114 115; Check the lowest useful OIHH value, which is 1<<32 greater than above. 116define i64 @f12(i64 %dummy, i64 *%src) { 117; CHECK-LABEL: f12: 118; CHECK: oihh %r0, 1 119; CHECK: br %r14 120 %res = atomicrmw or i64 *%src, i64 281474976710656 seq_cst 121 ret i64 %res 122} 123 124; Check the lowest useful OIHF value, which is 1<<32 greater again. 125define i64 @f13(i64 %dummy, i64 *%src) { 126; CHECK-LABEL: f13: 127; CHECK: oihf %r0, 65537 128; CHECK: br %r14 129 %res = atomicrmw or i64 *%src, i64 281479271677952 seq_cst 130 ret i64 %res 131} 132 133; Check the high end of the OIHH range. 134define i64 @f14(i64 %dummy, i64 *%src) { 135; CHECK-LABEL: f14: 136; CHECK: oihh %r0, 65535 137; CHECK: br %r14 138 %res = atomicrmw or i64 *%src, i64 18446462598732840960 seq_cst 139 ret i64 %res 140} 141 142; Check the next value up, which must use a register. 143define i64 @f15(i64 %dummy, i64 *%src) { 144; CHECK-LABEL: f15: 145; CHECK: ogr 146; CHECK: br %r14 147 %res = atomicrmw or i64 *%src, i64 18446462598732840961 seq_cst 148 ret i64 %res 149} 150 151; Check the high end of the OIHF range. 152define i64 @f16(i64 %dummy, i64 *%src) { 153; CHECK-LABEL: f16: 154; CHECK: oihf %r0, 4294967295 155; CHECK: br %r14 156 %res = atomicrmw or i64 *%src, i64 -4294967296 seq_cst 157 ret i64 %res 158} 159