1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s
5 define void @test_gep_i8(i8* %addr) {
6 %arrayidx = getelementptr i32, i32* undef, i8 5
10 define void @test_gep_i16(i8* %addr) {
11 %arrayidx = getelementptr i32, i32* undef, i16 5
15 define void @test_gep_i32(i8* %addr) {
16 %arrayidx = getelementptr i32, i32* undef, i32 5
20 define void @test_gep_i64(i8* %addr) {
21 %arrayidx = getelementptr i32, i32* undef, i64 5
34 ; CHECK-LABEL: name: test_gep_i8
35 ; CHECK: [[DEF:%[0-9]+]]:_(p0) = IMPLICIT_DEF
36 ; CHECK: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 20
37 ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[C]](s8)
38 ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[DEF]], [[SEXT]](s32)
39 ; CHECK: G_STORE [[GEP]](p0), [[DEF]](p0) :: (store 1 into %ir.addr)
42 %1(s8) = G_CONSTANT i8 20
43 %2(p0) = G_GEP %0, %1(s8)
44 G_STORE %2, %0 :: (store 1 into %ir.addr)
56 ; CHECK-LABEL: name: test_gep_i16
57 ; CHECK: [[DEF:%[0-9]+]]:_(p0) = IMPLICIT_DEF
58 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 20
59 ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[C]](s16)
60 ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[DEF]], [[SEXT]](s32)
61 ; CHECK: G_STORE [[GEP]](p0), [[DEF]](p0) :: (store 1 into %ir.addr)
64 %1(s16) = G_CONSTANT i16 20
65 %2(p0) = G_GEP %0, %1(s16)
66 G_STORE %2, %0 :: (store 1 into %ir.addr)
78 ; CHECK-LABEL: name: test_gep_i32
79 ; CHECK: [[DEF:%[0-9]+]]:_(p0) = IMPLICIT_DEF
80 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 20
81 ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[DEF]], [[C]](s32)
82 ; CHECK: G_STORE [[GEP]](p0), [[DEF]](p0) :: (store 1 into %ir.addr)
85 %1(s32) = G_CONSTANT i32 20
86 %2(p0) = G_GEP %0, %1(s32)
87 G_STORE %2, %0 :: (store 1 into %ir.addr)
99 ; CHECK-LABEL: name: test_gep_i64
100 ; CHECK: [[DEF:%[0-9]+]]:_(p0) = IMPLICIT_DEF
101 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 20
102 ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[DEF]], [[C]](s64)
103 ; CHECK: G_STORE [[GEP]](p0), [[DEF]](p0) :: (store 1 into %ir.addr)
105 %0(p0) = IMPLICIT_DEF
106 %1(s64) = G_CONSTANT i64 20
107 %2(p0) = G_GEP %0, %1(s64)
108 G_STORE %2, %0 :: (store 1 into %ir.addr)