| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 1 | ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s |
| 2 | target datalayout = "e-m:e-i64:64-n32:64" |
| 3 | target triple = "powerpc64le-unknown-linux-gnu" |
| 4 | |
| 5 | ; Make sure that we don't generate a std r, 0(0) -- the memory address cannot |
| 6 | ; be stored in r0. |
| 7 | ; CHECK-LABEL: @test1 |
| 8 | ; CHECK-NOT: std {{[0-9]+}}, 0(0) |
| 9 | ; CHECK: blr |
| 10 | |
| 11 | define void @test1({ i8*, void (i8*, i8*)* } %fn_arg) { |
| 12 | %fn = alloca { i8*, void (i8*, i8*)* } |
| 13 | %sp = alloca i8*, align 8 |
| 14 | %regs = alloca [18 x i64], align 8 |
| 15 | store { i8*, void (i8*, i8*)* } %fn_arg, { i8*, void (i8*, i8*)* }* %fn |
| 16 | %1 = bitcast [18 x i64]* %regs to i64* |
| 17 | call void asm sideeffect "std 14, $0", "=*m"(i64* %1) |
| 18 | %2 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 19 | %3 = getelementptr i8, i8* %2, i32 8 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 20 | %4 = bitcast i8* %3 to i64* |
| 21 | call void asm sideeffect "std 15, $0", "=*m"(i64* %4) |
| 22 | %5 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 23 | %6 = getelementptr i8, i8* %5, i32 16 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 24 | %7 = bitcast i8* %6 to i64* |
| 25 | call void asm sideeffect "std 16, $0", "=*m"(i64* %7) |
| 26 | %8 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 27 | %9 = getelementptr i8, i8* %8, i32 24 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 28 | %10 = bitcast i8* %9 to i64* |
| 29 | call void asm sideeffect "std 17, $0", "=*m"(i64* %10) |
| 30 | %11 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 31 | %12 = getelementptr i8, i8* %11, i32 32 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 32 | %13 = bitcast i8* %12 to i64* |
| 33 | call void asm sideeffect "std 18, $0", "=*m"(i64* %13) |
| 34 | %14 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 35 | %15 = getelementptr i8, i8* %14, i32 40 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 36 | %16 = bitcast i8* %15 to i64* |
| 37 | call void asm sideeffect "std 19, $0", "=*m"(i64* %16) |
| 38 | %17 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 39 | %18 = getelementptr i8, i8* %17, i32 48 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 40 | %19 = bitcast i8* %18 to i64* |
| 41 | call void asm sideeffect "std 20, $0", "=*m"(i64* %19) |
| 42 | %20 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 43 | %21 = getelementptr i8, i8* %20, i32 56 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 44 | %22 = bitcast i8* %21 to i64* |
| 45 | call void asm sideeffect "std 21, $0", "=*m"(i64* %22) |
| 46 | %23 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 47 | %24 = getelementptr i8, i8* %23, i32 64 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 48 | %25 = bitcast i8* %24 to i64* |
| 49 | call void asm sideeffect "std 22, $0", "=*m"(i64* %25) |
| 50 | %26 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 51 | %27 = getelementptr i8, i8* %26, i32 72 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 52 | %28 = bitcast i8* %27 to i64* |
| 53 | call void asm sideeffect "std 23, $0", "=*m"(i64* %28) |
| 54 | %29 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 55 | %30 = getelementptr i8, i8* %29, i32 80 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 56 | %31 = bitcast i8* %30 to i64* |
| 57 | call void asm sideeffect "std 24, $0", "=*m"(i64* %31) |
| 58 | %32 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 59 | %33 = getelementptr i8, i8* %32, i32 88 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 60 | %34 = bitcast i8* %33 to i64* |
| 61 | call void asm sideeffect "std 25, $0", "=*m"(i64* %34) |
| 62 | %35 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 63 | %36 = getelementptr i8, i8* %35, i32 96 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 64 | %37 = bitcast i8* %36 to i64* |
| 65 | call void asm sideeffect "std 26, $0", "=*m"(i64* %37) |
| 66 | %38 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 67 | %39 = getelementptr i8, i8* %38, i32 104 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 68 | %40 = bitcast i8* %39 to i64* |
| 69 | call void asm sideeffect "std 27, $0", "=*m"(i64* %40) |
| 70 | %41 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 71 | %42 = getelementptr i8, i8* %41, i32 112 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 72 | %43 = bitcast i8* %42 to i64* |
| 73 | call void asm sideeffect "std 28, $0", "=*m"(i64* %43) |
| 74 | %44 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 75 | %45 = getelementptr i8, i8* %44, i32 120 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 76 | %46 = bitcast i8* %45 to i64* |
| 77 | call void asm sideeffect "std 29, $0", "=*m"(i64* %46) |
| 78 | %47 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 79 | %48 = getelementptr i8, i8* %47, i32 128 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 80 | %49 = bitcast i8* %48 to i64* |
| 81 | call void asm sideeffect "std 30, $0", "=*m"(i64* %49) |
| 82 | %50 = bitcast [18 x i64]* %regs to i8* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 83 | %51 = getelementptr i8, i8* %50, i32 136 |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 84 | %52 = bitcast i8* %51 to i64* |
| 85 | call void asm sideeffect "std 31, $0", "=*m"(i64* %52) |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 86 | %53 = getelementptr { i8*, void (i8*, i8*)* }, { i8*, void (i8*, i8*)* }* %fn, i32 0, i32 1 |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 87 | %.funcptr = load void (i8*, i8*)*, void (i8*, i8*)** %53 |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 88 | %54 = getelementptr { i8*, void (i8*, i8*)* }, { i8*, void (i8*, i8*)* }* %fn, i32 0, i32 0 |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 89 | %.ptr = load i8*, i8** %54 |
| 90 | %55 = load i8*, i8** %sp |
| Hal Finkel | d433838 | 2014-12-03 23:40:13 +0000 | [diff] [blame] | 91 | call void %.funcptr(i8* %.ptr, i8* %55) |
| 92 | ret void |
| 93 | } |
| 94 | |