brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · e3368f6 Raw
133 lines · plain
1; Test 16-bit atomic XORs.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-SHIFT15; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -check-prefix=CHECK-SHIFT26 7; Check XOR of a variable.8; - CHECK is for the main loop.9; - CHECK-SHIFT1 makes sure that the negated shift count used by the second10;   RLL is set up correctly.  The negation is independent of the NILL and L11;   tested in CHECK.12; - CHECK-SHIFT2 makes sure that %b is shifted into the high part of the word13;   before being used.  This shift is independent of the other loop prologue14;   instructions.15define i16 @f1(ptr %src, i16 %b) {16; CHECK-LABEL: f1:17; CHECK: risbg [[RISBG:%r[1-9]+]], %r2, 0, 189, 0{{$}}18; CHECK-DAG: sll %r2, 319; CHECK-DAG: l [[OLD:%r[0-9]+]], 0([[RISBG]])20; CHECK: [[LABEL:\.[^:]*]]:21; CHECK: rll [[ROT:%r[0-9]+]], [[OLD]], 0(%r2)22; CHECK: xr [[ROT]], %r323; CHECK: rll [[NEW:%r[0-9]+]], [[ROT]], 0({{%r[1-9]+}})24; CHECK: cs [[OLD]], [[NEW]], 0([[RISBG]])25; CHECK: jl [[LABEL]]26; CHECK: rll %r2, [[OLD]], 16(%r2)27; CHECK: br %r1428;29; CHECK-SHIFT1-LABEL: f1:30; CHECK-SHIFT1: sll %r2, 331; CHECK-SHIFT1: lcr [[NEGSHIFT:%r[1-9]+]], %r232; CHECK-SHIFT1: rll33; CHECK-SHIFT1: rll {{%r[0-9]+}}, {{%r[0-9]+}}, 0([[NEGSHIFT]])34; CHECK-SHIFT1: rll35; CHECK-SHIFT1: br %r1436;37; CHECK-SHIFT2-LABEL: f1:38; CHECK-SHIFT2: sll %r3, 1639; CHECK-SHIFT2: rll40; CHECK-SHIFT2: xr {{%r[0-9]+}}, %r341; CHECK-SHIFT2: rll42; CHECK-SHIFT2: rll43; CHECK-SHIFT2: br %r1444  %res = atomicrmw xor ptr %src, i16 %b seq_cst45  ret i16 %res46}47 48; Check the minimum signed value.  We XOR the rotated word with 0x80000000.49define i16 @f2(ptr %src) {50; CHECK-LABEL: f2:51; CHECK: risbg [[RISBG:%r[1-9]+]], %r2, 0, 189, 0{{$}}52; CHECK-DAG: sll %r2, 353; CHECK-DAG: l [[OLD:%r[0-9]+]], 0([[RISBG]])54; CHECK: [[LABEL:\.[^:]*]]:55; CHECK: rll [[ROT:%r[0-9]+]], [[OLD]], 0(%r2)56; CHECK: xilf [[ROT]], 214748364857; CHECK: rll [[NEW:%r[0-9]+]], [[ROT]], 0([[NEGSHIFT:%r[1-9]+]])58; CHECK: cs [[OLD]], [[NEW]], 0([[RISBG]])59; CHECK: jl [[LABEL]]60; CHECK: rll %r2, [[OLD]], 16(%r2)61; CHECK: br %r1462;63; CHECK-SHIFT1-LABEL: f2:64; CHECK-SHIFT1: sll %r2, 365; CHECK-SHIFT1: lcr [[NEGSHIFT:%r[1-9]+]], %r266; CHECK-SHIFT1: rll67; CHECK-SHIFT1: rll {{%r[0-9]+}}, {{%r[0-9]+}}, 0([[NEGSHIFT]])68; CHECK-SHIFT1: rll69; CHECK-SHIFT1: br %r1470;71; CHECK-SHIFT2-LABEL: f2:72; CHECK-SHIFT2: br %r1473  %res = atomicrmw xor ptr %src, i16 -32768 seq_cst74  ret i16 %res75}76 77; Check XORs of -1.  We XOR the rotated word with 0xffff0000.78define i16 @f3(ptr %src) {79; CHECK-LABEL: f3:80; CHECK: xilf [[ROT]], 429490176081; CHECK: br %r1482;83; CHECK-SHIFT1-LABEL: f3:84; CHECK-SHIFT1: br %r1485; CHECK-SHIFT2-LABEL: f3:86; CHECK-SHIFT2: br %r1487  %res = atomicrmw xor ptr %src, i16 -1 seq_cst88  ret i16 %res89}90 91; Check XORs of 1.  We XOR the rotated word with 0x00010000.92define i16 @f4(ptr %src) {93; CHECK-LABEL: f4:94; CHECK: xilf [[ROT]], 6553695; CHECK: br %r1496;97; CHECK-SHIFT1-LABEL: f4:98; CHECK-SHIFT1: br %r1499; CHECK-SHIFT2-LABEL: f4:100; CHECK-SHIFT2: br %r14101  %res = atomicrmw xor ptr %src, i16 1 seq_cst102  ret i16 %res103}104 105; Check the maximum signed value.  We XOR the rotated word with 0x7fff0000.106define i16 @f5(ptr %src) {107; CHECK-LABEL: f5:108; CHECK: xilf [[ROT]], 2147418112109; CHECK: br %r14110;111; CHECK-SHIFT1-LABEL: f5:112; CHECK-SHIFT1: br %r14113; CHECK-SHIFT2-LABEL: f5:114; CHECK-SHIFT2: br %r14115  %res = atomicrmw xor ptr %src, i16 32767 seq_cst116  ret i16 %res117}118 119; Check XORs of a large unsigned value.  We XOR the rotated word with120; 0xfffd0000.121define i16 @f6(ptr %src) {122; CHECK-LABEL: f6:123; CHECK: xilf [[ROT]], 4294770688124; CHECK: br %r14125;126; CHECK-SHIFT1-LABEL: f6:127; CHECK-SHIFT1: br %r14128; CHECK-SHIFT2-LABEL: f6:129; CHECK-SHIFT2: br %r14130  %res = atomicrmw xor ptr %src, i16 65533 seq_cst131  ret i16 %res132}133