• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -pre-isel-intrinsic-lowering -S -o - %s | FileCheck %s
2
3; CHECK: define i8* @foo32(i8* [[P:%.*]], i32 [[O:%.*]])
4define i8* @foo32(i8* %p, i32 %o) {
5  ; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i32 [[O]]
6  ; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
7  ; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
8  ; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
9  ; CHECK: ret i8* [[R]]
10  %l = call i8* @llvm.load.relative.i32(i8* %p, i32 %o)
11  ret i8* %l
12}
13
14; CHECK: define i8* @foo64(i8* [[P:%.*]], i64 [[O:%.*]])
15define i8* @foo64(i8* %p, i64 %o) {
16  ; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i64 [[O]]
17  ; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
18  ; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
19  ; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
20  ; CHECK: ret i8* [[R]]
21  %l = call i8* @llvm.load.relative.i64(i8* %p, i64 %o)
22  ret i8* %l
23}
24
25declare i8* @llvm.load.relative.i32(i8*, i32)
26declare i8* @llvm.load.relative.i64(i8*, i64)
27