1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=arm64 | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 4*9880d681SAndroid Build Coastguard Worker; Tests for MOV-immediate implemented with ORR-immediate. 5*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker; 64-bit immed with 32-bit pattern size, rotated by 0. 8*9880d681SAndroid Build Coastguard Workerdefine i64 @test64_32_rot0() nounwind { 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test64_32_rot0: 10*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #30064771079 11*9880d681SAndroid Build Coastguard Worker ret i64 30064771079 12*9880d681SAndroid Build Coastguard Worker} 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker; 64-bit immed with 32-bit pattern size, rotated by 2. 15*9880d681SAndroid Build Coastguard Workerdefine i64 @test64_32_rot2() nounwind { 16*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test64_32_rot2: 17*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-4611686002321260541 18*9880d681SAndroid Build Coastguard Worker ret i64 13835058071388291075 19*9880d681SAndroid Build Coastguard Worker} 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; 64-bit immed with 4-bit pattern size, rotated by 3. 22*9880d681SAndroid Build Coastguard Workerdefine i64 @test64_4_rot3() nounwind { 23*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test64_4_rot3: 24*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-1229782938247303442 25*9880d681SAndroid Build Coastguard Worker ret i64 17216961135462248174 26*9880d681SAndroid Build Coastguard Worker} 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker; 32-bit immed with 32-bit pattern size, rotated by 16. 29*9880d681SAndroid Build Coastguard Workerdefine i32 @test32_32_rot16() nounwind { 30*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test32_32_rot16: 31*9880d681SAndroid Build Coastguard Worker; CHECK: orr w0, wzr, #0xff0000 32*9880d681SAndroid Build Coastguard Worker ret i32 16711680 33*9880d681SAndroid Build Coastguard Worker} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; 32-bit immed with 2-bit pattern size, rotated by 1. 36*9880d681SAndroid Build Coastguard Workerdefine i32 @test32_2_rot1() nounwind { 37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test32_2_rot1: 38*9880d681SAndroid Build Coastguard Worker; CHECK: mov w0, #-1431655766 39*9880d681SAndroid Build Coastguard Worker ret i32 2863311530 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 43*9880d681SAndroid Build Coastguard Worker; Tests for MOVZ with MOVK. 44*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerdefine i32 @movz() nounwind { 47*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movz: 48*9880d681SAndroid Build Coastguard Worker; CHECK: mov w0, #5 49*9880d681SAndroid Build Coastguard Worker ret i32 5 50*9880d681SAndroid Build Coastguard Worker} 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Workerdefine i64 @movz_3movk() nounwind { 53*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movz_3movk: 54*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #1407374883553280 55*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #4660, lsl #32 56*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #43981, lsl #16 57*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #22136 58*9880d681SAndroid Build Coastguard Worker ret i64 1427392313513592 59*9880d681SAndroid Build Coastguard Worker} 60*9880d681SAndroid Build Coastguard Worker 61*9880d681SAndroid Build Coastguard Workerdefine i64 @movz_movk_skip1() nounwind { 62*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movz_movk_skip1: 63*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #21474836480 64*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #17185, lsl #16 65*9880d681SAndroid Build Coastguard Worker ret i64 22601072640 66*9880d681SAndroid Build Coastguard Worker} 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Workerdefine i64 @movz_skip1_movk() nounwind { 69*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movz_skip1_movk: 70*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #147695335374848 71*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #4660 72*9880d681SAndroid Build Coastguard Worker ret i64 147695335379508 73*9880d681SAndroid Build Coastguard Worker} 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 76*9880d681SAndroid Build Coastguard Worker; Tests for MOVN with MOVK. 77*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Workerdefine i64 @movn() nounwind { 80*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movn: 81*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-42 82*9880d681SAndroid Build Coastguard Worker ret i64 -42 83*9880d681SAndroid Build Coastguard Worker} 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Workerdefine i64 @movn_skip1_movk() nounwind { 86*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: movn_skip1_movk: 87*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-176093659137 88*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: movk x0, #4660 89*9880d681SAndroid Build Coastguard Worker ret i64 -176093720012 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 93*9880d681SAndroid Build Coastguard Worker; Tests for ORR with MOVK. 94*9880d681SAndroid Build Coastguard Worker;==--------------------------------------------------------------------------== 95*9880d681SAndroid Build Coastguard Worker; rdar://14987673 96*9880d681SAndroid Build Coastguard Worker 97*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk1() nounwind { 98*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk1: 99*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #72056494543077120 100*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 101*9880d681SAndroid Build Coastguard Worker ret i64 72056498262245120 102*9880d681SAndroid Build Coastguard Worker} 103*9880d681SAndroid Build Coastguard Worker 104*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk2() nounwind { 105*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk2: 106*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #72056494543077120 107*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #48 108*9880d681SAndroid Build Coastguard Worker ret i64 -2400982650836746496 109*9880d681SAndroid Build Coastguard Worker} 110*9880d681SAndroid Build Coastguard Worker 111*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk3() nounwind { 112*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk3: 113*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #72056494543077120 114*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #32 115*9880d681SAndroid Build Coastguard Worker ret i64 72020953688702720 116*9880d681SAndroid Build Coastguard Worker} 117*9880d681SAndroid Build Coastguard Worker 118*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk4() nounwind { 119*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk4: 120*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #72056494543077120 121*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005 122*9880d681SAndroid Build Coastguard Worker ret i64 72056494543068845 123*9880d681SAndroid Build Coastguard Worker} 124*9880d681SAndroid Build Coastguard Worker 125*9880d681SAndroid Build Coastguard Worker; rdar://14987618 126*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk5() nounwind { 127*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk5: 128*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-71777214294589696 129*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 130*9880d681SAndroid Build Coastguard Worker ret i64 -71777214836900096 131*9880d681SAndroid Build Coastguard Worker} 132*9880d681SAndroid Build Coastguard Worker 133*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk6() nounwind { 134*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk6: 135*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-71777214294589696 136*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 137*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #48 138*9880d681SAndroid Build Coastguard Worker ret i64 -2400982647117578496 139*9880d681SAndroid Build Coastguard Worker} 140*9880d681SAndroid Build Coastguard Worker 141*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk7() nounwind { 142*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk7: 143*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-71777214294589696 144*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #48 145*9880d681SAndroid Build Coastguard Worker ret i64 -2400982646575268096 146*9880d681SAndroid Build Coastguard Worker} 147*9880d681SAndroid Build Coastguard Worker 148*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk8() nounwind { 149*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk8: 150*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-71777214294589696 151*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005 152*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #48 153*9880d681SAndroid Build Coastguard Worker ret i64 -2400982646575276371 154*9880d681SAndroid Build Coastguard Worker} 155*9880d681SAndroid Build Coastguard Worker 156*9880d681SAndroid Build Coastguard Worker; rdar://14987715 157*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk9() nounwind { 158*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk9: 159*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #1152921435887370240 160*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #65280 161*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 162*9880d681SAndroid Build Coastguard Worker ret i64 1152921439623315200 163*9880d681SAndroid Build Coastguard Worker} 164*9880d681SAndroid Build Coastguard Worker 165*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk10() nounwind { 166*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk10: 167*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #1152921504606846720 168*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 169*9880d681SAndroid Build Coastguard Worker ret i64 1152921504047824640 170*9880d681SAndroid Build Coastguard Worker} 171*9880d681SAndroid Build Coastguard Worker 172*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk11() nounwind { 173*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk11: 174*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-4503599627370241 175*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #16 176*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #65535, lsl #32 177*9880d681SAndroid Build Coastguard Worker ret i64 -4222125209747201 178*9880d681SAndroid Build Coastguard Worker} 179*9880d681SAndroid Build Coastguard Worker 180*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk12() nounwind { 181*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk12: 182*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-4503599627370241 183*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #32 184*9880d681SAndroid Build Coastguard Worker ret i64 -4258765016661761 185*9880d681SAndroid Build Coastguard Worker} 186*9880d681SAndroid Build Coastguard Worker 187*9880d681SAndroid Build Coastguard Workerdefine i64 @orr_movk13() nounwind { 188*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: orr_movk13: 189*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #17592169267200 190*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005 191*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #57005, lsl #48 192*9880d681SAndroid Build Coastguard Worker ret i64 -2401245434149282131 193*9880d681SAndroid Build Coastguard Worker} 194*9880d681SAndroid Build Coastguard Worker 195*9880d681SAndroid Build Coastguard Worker; rdar://13944082 196*9880d681SAndroid Build Coastguard Workerdefine i64 @g() nounwind { 197*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: g: 198*9880d681SAndroid Build Coastguard Worker; CHECK: mov x0, #-281474976710656 199*9880d681SAndroid Build Coastguard Worker; CHECK: movk x0, #2 200*9880d681SAndroid Build Coastguard Workerentry: 201*9880d681SAndroid Build Coastguard Worker ret i64 -281474976710654 202*9880d681SAndroid Build Coastguard Worker} 203