2013-05-07 00:17:29 +08:00
|
|
|
; Test 64-bit GPR accesses to a PC-relative location.
|
|
|
|
;
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
|
|
|
|
@gsrc16 = global i16 1
|
|
|
|
@gsrc32 = global i32 1
|
|
|
|
@gsrc64 = global i64 1
|
|
|
|
@gdst16 = global i16 2
|
|
|
|
@gdst32 = global i32 2
|
|
|
|
@gdst64 = global i64 2
|
2013-05-30 17:45:42 +08:00
|
|
|
@gsrc16u = global i16 1, align 1, section "foo"
|
|
|
|
@gsrc32u = global i32 1, align 2, section "foo"
|
|
|
|
@gsrc64u = global i64 1, align 4, section "foo"
|
|
|
|
@gdst16u = global i16 2, align 1, section "foo"
|
|
|
|
@gdst32u = global i32 2, align 2, section "foo"
|
|
|
|
@gdst64u = global i64 2, align 4, section "foo"
|
2013-05-07 00:17:29 +08:00
|
|
|
|
|
|
|
; Check sign-extending loads from i16.
|
|
|
|
define i64 @f1() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f1:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: lghrl %r2, gsrc16
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i16 , i16 *@gsrc16
|
2013-05-07 00:17:29 +08:00
|
|
|
%ext = sext i16 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check zero-extending loads from i16.
|
|
|
|
define i64 @f2() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f2:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: llghrl %r2, gsrc16
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i16 , i16 *@gsrc16
|
2013-05-07 00:17:29 +08:00
|
|
|
%ext = zext i16 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check sign-extending loads from i32.
|
|
|
|
define i64 @f3() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f3:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: lgfrl %r2, gsrc32
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32 , i32 *@gsrc32
|
2013-05-07 00:17:29 +08:00
|
|
|
%ext = sext i32 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check zero-extending loads from i32.
|
|
|
|
define i64 @f4() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f4:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: llgfrl %r2, gsrc32
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32 , i32 *@gsrc32
|
2013-05-07 00:17:29 +08:00
|
|
|
%ext = zext i32 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check truncating 16-bit stores.
|
|
|
|
define void @f5(i64 %val) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f5:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: sthrl %r2, gdst16
|
|
|
|
; CHECK: br %r14
|
|
|
|
%half = trunc i64 %val to i16
|
|
|
|
store i16 %half, i16 *@gdst16
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check truncating 32-bit stores.
|
|
|
|
define void @f6(i64 %val) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f6:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: strl %r2, gdst32
|
|
|
|
; CHECK: br %r14
|
|
|
|
%word = trunc i64 %val to i32
|
|
|
|
store i32 %word, i32 *@gdst32
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check plain loads and stores.
|
|
|
|
define void @f7() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f7:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK: lgrl %r0, gsrc64
|
|
|
|
; CHECK: stgrl %r0, gdst64
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i64 , i64 *@gsrc64
|
2013-05-07 00:17:29 +08:00
|
|
|
store i64 %val, i64 *@gdst64
|
|
|
|
ret void
|
|
|
|
}
|
2013-05-30 17:45:42 +08:00
|
|
|
|
|
|
|
; Repeat f1 with an unaligned variable.
|
|
|
|
define i64 @f8() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f8:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: lgrl [[REG:%r[0-5]]], gsrc16u@GOT
|
|
|
|
; CHECK: lgh %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i16 , i16 *@gsrc16u, align 1
|
2013-05-30 17:45:42 +08:00
|
|
|
%ext = sext i16 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f2 with an unaligned variable.
|
|
|
|
define i64 @f9() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f9:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: lgrl [[REG:%r[0-5]]], gsrc16u@GOT
|
|
|
|
; CHECK: llgh %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i16 , i16 *@gsrc16u, align 1
|
2013-05-30 17:45:42 +08:00
|
|
|
%ext = zext i16 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f3 with an unaligned variable.
|
|
|
|
define i64 @f10() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f10:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: larl [[REG:%r[0-5]]], gsrc32u
|
|
|
|
; CHECK: lgf %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32 , i32 *@gsrc32u, align 2
|
2013-05-30 17:45:42 +08:00
|
|
|
%ext = sext i32 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f4 with an unaligned variable.
|
|
|
|
define i64 @f11() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f11:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: larl [[REG:%r[0-5]]], gsrc32u
|
|
|
|
; CHECK: llgf %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32 , i32 *@gsrc32u, align 2
|
2013-05-30 17:45:42 +08:00
|
|
|
%ext = zext i32 %val to i64
|
|
|
|
ret i64 %ext
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f5 with an unaligned variable.
|
|
|
|
define void @f12(i64 %val) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f12:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: lgrl [[REG:%r[0-5]]], gdst16u@GOT
|
|
|
|
; CHECK: sth %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
|
|
|
%half = trunc i64 %val to i16
|
|
|
|
store i16 %half, i16 *@gdst16u, align 1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f6 with an unaligned variable.
|
|
|
|
define void @f13(i64 %val) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f13:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: larl [[REG:%r[0-5]]], gdst32u
|
|
|
|
; CHECK: st %r2, 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
|
|
|
%word = trunc i64 %val to i32
|
|
|
|
store i32 %word, i32 *@gdst32u, align 2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f7 with unaligned variables.
|
|
|
|
define void @f14() {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: f14:
|
2013-05-30 17:45:42 +08:00
|
|
|
; CHECK: larl [[REG:%r[0-5]]], gsrc64u
|
|
|
|
; CHECK: lg [[VAL:%r[0-5]]], 0([[REG]])
|
|
|
|
; CHECK: larl [[REG:%r[0-5]]], gdst64u
|
|
|
|
; CHECK: stg [[VAL]], 0([[REG]])
|
|
|
|
; CHECK: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i64 , i64 *@gsrc64u, align 4
|
2013-05-30 17:45:42 +08:00
|
|
|
store i64 %val, i64 *@gdst64u, align 4
|
|
|
|
ret void
|
|
|
|
}
|