2016-07-19 21:35:11 +08:00
|
|
|
; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
; Tests for MOV-immediate implemented with ORR-immediate.
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
|
|
|
|
; 64-bit immed with 32-bit pattern size, rotated by 0.
|
|
|
|
define i64 @test64_32_rot0() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: test64_32_rot0:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #30064771079
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 30064771079
|
|
|
|
}
|
|
|
|
|
|
|
|
; 64-bit immed with 32-bit pattern size, rotated by 2.
|
|
|
|
define i64 @test64_32_rot2() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: test64_32_rot2:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-4611686002321260541
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 13835058071388291075
|
|
|
|
}
|
|
|
|
|
|
|
|
; 64-bit immed with 4-bit pattern size, rotated by 3.
|
|
|
|
define i64 @test64_4_rot3() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: test64_4_rot3:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-1229782938247303442
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 17216961135462248174
|
|
|
|
}
|
|
|
|
|
|
|
|
; 32-bit immed with 32-bit pattern size, rotated by 16.
|
|
|
|
define i32 @test32_32_rot16() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: test32_32_rot16:
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK: orr w0, wzr, #0xff0000
|
|
|
|
ret i32 16711680
|
|
|
|
}
|
|
|
|
|
|
|
|
; 32-bit immed with 2-bit pattern size, rotated by 1.
|
|
|
|
define i32 @test32_2_rot1() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: test32_2_rot1:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov w0, #-1431655766
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i32 2863311530
|
|
|
|
}
|
|
|
|
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
; Tests for MOVZ with MOVK.
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
|
|
|
|
define i32 @movz() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movz:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov w0, #5
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i32 5
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @movz_3movk() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movz_3movk:
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK: mov x0, #22136
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK-NEXT: movk x0, #43981, lsl #16
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK-NEXT: movk x0, #4660, lsl #32
|
|
|
|
; CHECK-NEXT: movk x0, #5, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 1427392313513592
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @movz_movk_skip1() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movz_movk_skip1:
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK: mov x0, #1126236160
|
|
|
|
; CHECK-NEXT: movk x0, #5, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 22601072640
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @movz_skip1_movk() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movz_skip1_movk:
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK: mov x0, #4660
|
|
|
|
; CHECK-NEXT: movk x0, #34388, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 147695335379508
|
|
|
|
}
|
|
|
|
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
; Tests for MOVN with MOVK.
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
|
|
|
|
define i64 @movn() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movn:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-42
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -42
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @movn_skip1_movk() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: movn_skip1_movk:
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK: mov x0, #-60876
|
|
|
|
; CHECK-NEXT: movk x0, #65494, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -176093720012
|
|
|
|
}
|
|
|
|
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
; Tests for ORR with MOVK.
|
|
|
|
;==--------------------------------------------------------------------------==
|
|
|
|
; rdar://14987673
|
|
|
|
|
|
|
|
define i64 @orr_movk1() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk1:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #72056494543077120
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 72056498262245120
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk2() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk2:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #72056494543077120
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -2400982650836746496
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk3() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk3:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #72056494543077120
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 72020953688702720
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk4() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk4:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #72056494543077120
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 72056494543068845
|
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://14987618
|
|
|
|
define i64 @orr_movk5() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk5:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-71777214294589696
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -71777214836900096
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk6() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk6:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-71777214294589696
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
|
|
|
; CHECK: movk x0, #57005, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -2400982647117578496
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk7() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk7:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-71777214294589696
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -2400982646575268096
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk8() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk8:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-71777214294589696
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005
|
|
|
|
; CHECK: movk x0, #57005, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -2400982646575276371
|
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://14987715
|
|
|
|
define i64 @orr_movk9() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk9:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #1152921435887370240
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #65280
|
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 1152921439623315200
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk10() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk10:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #1152921504606846720
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 1152921504047824640
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk11() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk11:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-4503599627370241
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #16
|
|
|
|
; CHECK: movk x0, #65535, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -4222125209747201
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk12() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk12:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #-4503599627370241
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005, lsl #32
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -4258765016661761
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @orr_movk13() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: orr_movk13:
|
2016-06-16 09:42:25 +08:00
|
|
|
; CHECK: mov x0, #17592169267200
|
2016-05-14 02:00:09 +08:00
|
|
|
; CHECK: movk x0, #57005
|
|
|
|
; CHECK: movk x0, #57005, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
ret i64 -2401245434149282131
|
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://13944082
|
|
|
|
define i64 @g() nounwind {
|
2014-04-30 19:19:40 +08:00
|
|
|
; CHECK-LABEL: g:
|
2017-01-19 02:57:08 +08:00
|
|
|
; CHECK: mov x0, #2
|
|
|
|
; CHECK: movk x0, #65535, lsl #48
|
2014-03-29 18:18:08 +08:00
|
|
|
entry:
|
|
|
|
ret i64 -281474976710654
|
|
|
|
}
|