blob: 7497362a15462c5926e71f576c06cdc9bf3fcff6 [file] [log] [blame]
Evan Chengf481d512007-11-05 03:04:26 +00001; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -o %t1 -f
Dan Gohman8c89a502007-08-15 13:36:28 +00002; RUN: grep GOTPCREL %t1 | count 4
Dale Johannesenbf23d3f2008-04-08 00:14:17 +00003; RUN: grep %%rip %t1 | count 6
Dan Gohman8c89a502007-08-15 13:36:28 +00004; RUN: grep movq %t1 | count 6
5; RUN: grep leaq %t1 | count 1
Evan Chengf481d512007-11-05 03:04:26 +00006; RUN: llvm-as < %s | \
Evan Chengc9cb89b2007-08-02 05:04:16 +00007; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=static -o %t2 -f
Dan Gohman8c89a502007-08-15 13:36:28 +00008; RUN: grep movl %t2 | count 2
9; RUN: grep movq %t2 | count 2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010
Evan Chengf481d512007-11-05 03:04:26 +000011@ptr = external global i32* ; <i32**> [#uses=1]
12@src = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
13@dst = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
14@lptr = internal global i32* null ; <i32**> [#uses=1]
15@ldst = internal global [500 x i32] zeroinitializer, align 32 ; <[500 x i32]*> [#uses=1]
16@lsrc = internal global [500 x i32] zeroinitializer, align 32 ; <[500 x i32]*> [#uses=0]
17@bsrc = internal global [500000 x i32] zeroinitializer, align 32 ; <[500000 x i32]*> [#uses=0]
18@bdst = internal global [500000 x i32] zeroinitializer, align 32 ; <[500000 x i32]*> [#uses=0]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000019
Dale Johannesen6e04eac2008-03-31 23:20:09 +000020define void @test1() nounwind {
Evan Chengf481d512007-11-05 03:04:26 +000021 %tmp = load i32* getelementptr ([0 x i32]* @src, i32 0, i32 0) ; <i32> [#uses=1]
22 store i32 %tmp, i32* getelementptr ([0 x i32]* @dst, i32 0, i32 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000023 ret void
24}
25
Dale Johannesen6e04eac2008-03-31 23:20:09 +000026define void @test2() nounwind {
Evan Chengf481d512007-11-05 03:04:26 +000027 store i32* getelementptr ([0 x i32]* @dst, i32 0, i32 0), i32** @ptr
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028 ret void
29}
30
Dale Johannesen6e04eac2008-03-31 23:20:09 +000031define void @test3() nounwind {
Evan Chengf481d512007-11-05 03:04:26 +000032 store i32* getelementptr ([500 x i32]* @ldst, i32 0, i32 0), i32** @lptr
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033 br label %return
34
Evan Chengf481d512007-11-05 03:04:26 +000035return: ; preds = %0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000036 ret void
37}