brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · e2cd929 Raw
102 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 22; Test use of LOAD LOGICAL INDEXED ADDRESS halfword instructions.3;4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z17 | FileCheck %s5 6; LLXAH with base and index.7define dso_local ptr @f0(ptr %ptr, i32 %idx) {8; CHECK-LABEL: f0:9; CHECK:       # %bb.0:10; CHECK-NEXT:    llxah %r2, 0(%r3,%r2)11; CHECK-NEXT:    br %r1412  %idxprom = zext i32 %idx to i6413  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom14  ret ptr %arrayidx15}16 17; LLXAH with base and index (implied extension).18define dso_local ptr @f1(ptr %ptr, i32 zeroext %idx) {19; CHECK-LABEL: f1:20; CHECK:       # %bb.0:21; CHECK-NEXT:    llxah %r2, 0(%r3,%r2)22; CHECK-NEXT:    br %r1423  %idxprom = zext i32 %idx to i6424  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom25  ret ptr %arrayidx26}27 28; LLXAH with base and index and max displacement.29define dso_local ptr @f2(ptr %ptr, i32 %idx) {30; CHECK-LABEL: f2:31; CHECK:       # %bb.0:32; CHECK-NEXT:    llxah %r2, 524287(%r3,%r2)33; CHECK-NEXT:    br %r1434  %idxoff = add i32 %idx, 52428735  %idxprom = zext i32 %idxoff to i6436  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom37  ret ptr %arrayidx38}39 40; LLXAH with base and index and min displacement.41define dso_local ptr @f3(ptr %ptr, i32 %idx) {42; CHECK-LABEL: f3:43; CHECK:       # %bb.0:44; CHECK-NEXT:    llxah %r2, -524288(%r3,%r2)45; CHECK-NEXT:    br %r1446  %idxoff = add i32 %idx, -52428847  %idxprom = zext i32 %idxoff to i6448  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom49  ret ptr %arrayidx50}51 52; LLXAH with base and index and max displacement overflow.53define dso_local ptr @f4(ptr %ptr, i32 %idx) {54; CHECK-LABEL: f4:55; CHECK:       # %bb.0:56; CHECK-NEXT:    afi %r3, 52428857; CHECK-NEXT:    llxah %r2, 0(%r3,%r2)58; CHECK-NEXT:    br %r1459  %idxoff = add i32 %idx, 52428860  %idxprom = zext i32 %idxoff to i6461  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom62  ret ptr %arrayidx63}64 65; LLXAH with base and index and min displacement overflow.66define dso_local ptr @f5(ptr %ptr, i32 %idx) {67; CHECK-LABEL: f5:68; CHECK:       # %bb.0:69; CHECK-NEXT:    afi %r3, -52428970; CHECK-NEXT:    llxah %r2, 0(%r3,%r2)71; CHECK-NEXT:    br %r1472  %idxoff = add i32 %idx, -52428973  %idxprom = zext i32 %idxoff to i6474  %arrayidx = getelementptr inbounds i16, ptr %ptr, i64 %idxprom75  ret ptr %arrayidx76}77 78; DO NOT USE: LLXAH with index.79define dso_local i64 @f6(i32 %idx) {80; CHECK-LABEL: f6:81; CHECK:       # %bb.0:82; CHECK-NEXT:    # kill: def $r2l killed $r2l def $r2d83; CHECK-NEXT:    risbgn %r2, %r2, 31, 190, 184; CHECK-NEXT:    br %r1485  %idxprom = zext i32 %idx to i6486  %idxshift = shl i64 %idxprom, 187  ret i64 %idxshift88}89 90; LLXAH with index and displacement.91define dso_local i64 @f7(i32 %idx) {92; CHECK-LABEL: f7:93; CHECK:       # %bb.0:94; CHECK-NEXT:    llxah %r2, 1(%r2,0)95; CHECK-NEXT:    br %r1496  %idxoff = add i32 %idx, 197  %idxprom = zext i32 %idxoff to i6498  %idxshift = shl i64 %idxprom, 199  ret i64 %idxshift100}101 102