2014-05-24 20:50:23 +08:00
|
|
|
; RUN: llc -mtriple=aarch64-linux-gnu -o - %s | FileCheck %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
@var = global i1 0
|
|
|
|
|
|
|
|
define i32 @test_sextloadi32() {
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK-LABEL: test_sextloadi32
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i1, i1* @var
|
2013-01-31 20:12:40 +08:00
|
|
|
%ret = sext i1 %val to i32
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:var]
|
2014-04-25 18:25:29 +08:00
|
|
|
; CHECK: {{sbfx x[0-9]+, x[0-9]+, #0, #1|sbfx w[0-9]+, w[0-9]+, #0, #1}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret i32 %ret
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_sextloadi64() {
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK-LABEL: test_sextloadi64
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i1, i1* @var
|
2013-01-31 20:12:40 +08:00
|
|
|
%ret = sext i1 %val to i64
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:var]
|
2014-04-25 18:25:29 +08:00
|
|
|
; CHECK: {{sbfx x[0-9]+, x[0-9]+, #0, #1}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret i64 %ret
|
|
|
|
; CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_zextloadi32() {
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK-LABEL: test_zextloadi32
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; It's not actually necessary that "ret" is next, but as far as LLVM
|
|
|
|
; is concerned only 0 or 1 should be loadable so no extension is
|
|
|
|
; necessary.
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i1, i1* @var
|
2013-01-31 20:12:40 +08:00
|
|
|
%ret = zext i1 %val to i32
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:var]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret i32 %ret
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_zextloadi64() {
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK-LABEL: test_zextloadi64
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; It's not actually necessary that "ret" is next, but as far as LLVM
|
|
|
|
; is concerned only 0 or 1 should be loadable so no extension is
|
|
|
|
; necessary.
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i1, i1* @var
|
2013-01-31 20:12:40 +08:00
|
|
|
%ret = zext i1 %val to i64
|
2014-04-14 20:50:58 +08:00
|
|
|
; CHECK: ldrb {{w[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:var]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret i64 %ret
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
}
|