Xamarin Public Jenkins (auto-signing) 468663ddbb Imported Upstream version 6.10.0.49
Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
2020-01-16 16:38:04 +00:00

28 lines
1.1 KiB
LLVM

; RUN: opt -pre-isel-intrinsic-lowering -S -o - %s | FileCheck %s
; RUN: opt -passes='pre-isel-intrinsic-lowering' -S -o - %s | FileCheck %s
; CHECK: define i8* @foo32(i8* [[P:%.*]], i32 [[O:%.*]])
define i8* @foo32(i8* %p, i32 %o) {
; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i32 [[O]]
; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
; CHECK: ret i8* [[R]]
%l = call i8* @llvm.load.relative.i32(i8* %p, i32 %o)
ret i8* %l
}
; CHECK: define i8* @foo64(i8* [[P:%.*]], i64 [[O:%.*]])
define i8* @foo64(i8* %p, i64 %o) {
; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i64 [[O]]
; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
; CHECK: ret i8* [[R]]
%l = call i8* @llvm.load.relative.i64(i8* %p, i64 %o)
ret i8* %l
}
declare i8* @llvm.load.relative.i32(i8*, i32)
declare i8* @llvm.load.relative.i64(i8*, i64)