blob: 88af3de58385dc23a496a1c4854a17ed558f438a [file] [log] [blame]
Colin LeMahieub8575b12015-06-13 21:46:39 +00001; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 < %s | FileCheck %s
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +00002; Check that we generate load instructions with absolute addressing mode.
3
Colin LeMahieub8575b12015-06-13 21:46:39 +00004@a0 = external global i32
5@a1 = external global i32
6@b0 = external global i8
7@b1 = external global i8
8@c0 = external global i16
9@c1 = external global i16
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000010@d = external global i64
11
12define zeroext i8 @absStoreByte() nounwind {
Krzysztof Parzyszekc9f797f2018-03-06 19:07:21 +000013; CHECK: memb(##b1) = r{{[0-9]+}}
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000014entry:
Colin LeMahieub8575b12015-06-13 21:46:39 +000015 %0 = load i8, i8* @b0, align 1
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000016 %conv = zext i8 %0 to i32
17 %mul = mul nsw i32 100, %conv
18 %conv1 = trunc i32 %mul to i8
Colin LeMahieub8575b12015-06-13 21:46:39 +000019 store i8 %conv1, i8* @b1, align 1
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000020 ret i8 %conv1
21}
22
23define signext i16 @absStoreHalf() nounwind {
Krzysztof Parzyszekc9f797f2018-03-06 19:07:21 +000024; CHECK: memh(##c1) = r{{[0-9]+}}
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000025entry:
Colin LeMahieub8575b12015-06-13 21:46:39 +000026 %0 = load i16, i16* @c0, align 2
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000027 %conv = sext i16 %0 to i32
28 %mul = mul nsw i32 100, %conv
29 %conv1 = trunc i32 %mul to i16
Colin LeMahieub8575b12015-06-13 21:46:39 +000030 store i16 %conv1, i16* @c1, align 2
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000031 ret i16 %conv1
32}
33
34define i32 @absStoreWord() nounwind {
Krzysztof Parzyszekc9f797f2018-03-06 19:07:21 +000035; CHECK: memw(##a1) = r{{[0-9]+}}
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000036entry:
Colin LeMahieub8575b12015-06-13 21:46:39 +000037 %0 = load i32, i32* @a0, align 4
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000038 %mul = mul nsw i32 100, %0
Colin LeMahieub8575b12015-06-13 21:46:39 +000039 store i32 %mul, i32* @a1, align 4
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000040 ret i32 %mul
41}
42
43define void @absStoreDouble() nounwind {
Krzysztof Parzyszekc9f797f2018-03-06 19:07:21 +000044; CHECK: memd(##d) = r{{[0-9]+}}:{{[0-9]+}}
Jyotsna Verma50ca6dd2013-02-05 18:15:34 +000045entry:
46 store i64 100, i64* @d, align 8
47 ret void
48}
49