1 ; RUN: opt -pre-isel-intrinsic-lowering -S -o - %s | FileCheck %s
2 ; RUN: opt -passes='pre-isel-intrinsic-lowering' -S -o - %s | FileCheck %s
4 ; CHECK: define i8* @foo32(i8* [[P:%.*]], i32 [[O:%.*]])
5 define i8* @foo32(i8* %p, i32 %o) {
6 ; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i32 [[O]]
7 ; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
8 ; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
9 ; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
10 ; CHECK: ret i8* [[R]]
11 %l = call i8* @llvm.load.relative.i32(i8* %p, i32 %o)
15 ; CHECK: define i8* @foo64(i8* [[P:%.*]], i64 [[O:%.*]])
16 define i8* @foo64(i8* %p, i64 %o) {
17 ; CHECK: [[OP:%.*]] = getelementptr i8, i8* [[P]], i64 [[O]]
18 ; CHECK: [[OPI32:%.*]] = bitcast i8* [[OP]] to i32*
19 ; CHECK: [[OI32:%.*]] = load i32, i32* [[OPI32]], align 4
20 ; CHECK: [[R:%.*]] = getelementptr i8, i8* [[P]], i32 [[OI32]]
21 ; CHECK: ret i8* [[R]]
22 %l = call i8* @llvm.load.relative.i64(i8* %p, i64 %o)
26 declare i8* @llvm.load.relative.i32(i8*, i32)
27 declare i8* @llvm.load.relative.i64(i8*, i64)