1*9880d681SAndroid Build Coastguard Worker; Test the "T" asm constraint, which accepts addresses that have a base, 2*9880d681SAndroid Build Coastguard Worker; an index and a 20-bit displacement. 3*9880d681SAndroid Build Coastguard Worker; 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; Check the lowest range. 7*9880d681SAndroid Build Coastguard Workerdefine void @f1(i64 %base) { 8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1: 9*9880d681SAndroid Build Coastguard Worker; CHECK: blah -524288(%r2) 10*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 11*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, -524288 12*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %add to i64 * 13*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 14*9880d681SAndroid Build Coastguard Worker ret void 15*9880d681SAndroid Build Coastguard Worker} 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker; Check the next lowest byte. 18*9880d681SAndroid Build Coastguard Workerdefine void @f2(i64 %base) { 19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2: 20*9880d681SAndroid Build Coastguard Worker; CHECK: agfi %r2, -524289 21*9880d681SAndroid Build Coastguard Worker; CHECK: blah 0(%r2) 22*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 23*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, -524289 24*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %add to i64 * 25*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 26*9880d681SAndroid Build Coastguard Worker ret void 27*9880d681SAndroid Build Coastguard Worker} 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; Check the highest range. 30*9880d681SAndroid Build Coastguard Workerdefine void @f3(i64 %base) { 31*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3: 32*9880d681SAndroid Build Coastguard Worker; CHECK: blah 524287(%r2) 33*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 34*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, 524287 35*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %add to i64 * 36*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 37*9880d681SAndroid Build Coastguard Worker ret void 38*9880d681SAndroid Build Coastguard Worker} 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker; Check the next highest byte. 41*9880d681SAndroid Build Coastguard Workerdefine void @f4(i64 %base) { 42*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4: 43*9880d681SAndroid Build Coastguard Worker; CHECK: agfi %r2, 524288 44*9880d681SAndroid Build Coastguard Worker; CHECK: blah 0(%r2) 45*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 46*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, 524288 47*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %add to i64 * 48*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 49*9880d681SAndroid Build Coastguard Worker ret void 50*9880d681SAndroid Build Coastguard Worker} 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker; Check that indices are allowed 53*9880d681SAndroid Build Coastguard Workerdefine void @f5(i64 %base, i64 %index) { 54*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f5: 55*9880d681SAndroid Build Coastguard Worker; CHECK: blah 0(%r3,%r2) 56*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 57*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, %index 58*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %add to i64 * 59*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 60*9880d681SAndroid Build Coastguard Worker ret void 61*9880d681SAndroid Build Coastguard Worker} 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Worker; Check that indices and displacements are allowed simultaneously 64*9880d681SAndroid Build Coastguard Workerdefine void @f6(i64 %base, i64 %index) { 65*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f6: 66*9880d681SAndroid Build Coastguard Worker; CHECK: blah 524287(%r3,%r2) 67*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 68*9880d681SAndroid Build Coastguard Worker %add = add i64 %base, 524287 69*9880d681SAndroid Build Coastguard Worker %addi = add i64 %add, %index 70*9880d681SAndroid Build Coastguard Worker %addr = inttoptr i64 %addi to i64 * 71*9880d681SAndroid Build Coastguard Worker call void asm "blah $0", "=*T" (i64 *%addr) 72*9880d681SAndroid Build Coastguard Worker ret void 73*9880d681SAndroid Build Coastguard Worker} 74