blob: 62b2ea34ade15dcd04f753a08b4290f70e164fb6 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu | FileCheck %s
Tim Northovere0e3aef2013-01-31 12:12:40 +00002
3@var32 = global i32 0
4@var64 = global i64 0
5
6define void @test_zr() {
Stephen Linf799e3f2013-07-13 20:38:47 +00007; CHECK-LABEL: test_zr:
Tim Northovere0e3aef2013-01-31 12:12:40 +00008
9 store i32 0, i32* @var32
Tim Northover46ecdf52014-04-16 11:53:07 +000010; CHECK: str wzr, [{{x[0-9]+}}, {{#?}}:lo12:var32]
Tim Northovere0e3aef2013-01-31 12:12:40 +000011 store i64 0, i64* @var64
Tim Northover46ecdf52014-04-16 11:53:07 +000012; CHECK: str xzr, [{{x[0-9]+}}, {{#?}}:lo12:var64]
Tim Northovere0e3aef2013-01-31 12:12:40 +000013
14 ret void
15; CHECK: ret
16}
17
18define void @test_sp(i32 %val) {
Stephen Linf799e3f2013-07-13 20:38:47 +000019; CHECK-LABEL: test_sp:
Tim Northovere0e3aef2013-01-31 12:12:40 +000020
21; Important correctness point here is that LLVM doesn't try to use xzr
22; as an addressing register: "str w0, [xzr]" is not a valid A64
23; instruction (0b11111 in the Rn field would mean "sp").
David Blaikie79e6c742015-02-27 19:29:02 +000024 %addr = getelementptr i32, i32* null, i64 0
Tim Northovere0e3aef2013-01-31 12:12:40 +000025 store i32 %val, i32* %addr
Tim Northover46ecdf52014-04-16 11:53:07 +000026; CHECK: str {{w[0-9]+}}, [{{x[0-9]+|sp}}]
Tim Northovere0e3aef2013-01-31 12:12:40 +000027
28 ret void
29; CHECK: ret
Stephen Linf799e3f2013-07-13 20:38:47 +000030}