1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
llvm-mirror/test/Transforms/PreISelIntrinsicLowering/load-relative.ll
Yuanfang Chen dbdc922af7 Remove Passes dependency on CodeGen
The dependency was introduced in
5134020ea62d1e1e125fdac48d251a26b80e9781. The only functional change
from this removal would be the new PM interface for the two codegen
passes. This is not necessary since we don't have codegen pipeline using
new PM yet. This removal is to break the potential circular dependency between
Passes and CodeGen once the codegen begins to gain new PM support.
2020-06-24 14:52:46 -07:00

27 lines
1023 B
LLVM

; RUN: opt -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)