Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s |
Hal Finkel | c8cf2b8 | 2014-12-09 01:00:59 +0000 | [diff] [blame] | 2 | target datalayout = "E-m:e-i64:64-n32:64" |
| 3 | target triple = "powerpc64-unknown-linux-gnu" |
| 4 | |
| 5 | %struct.inode.0.12.120 = type { i8* } |
| 6 | %struct.kstat2.1.13.121 = type { i32 } |
| 7 | %struct.task_struct.4.16.124 = type { i8*, %struct.atomic_t.2.14.122, %struct.signal_struct.3.15.123* } |
| 8 | %struct.atomic_t.2.14.122 = type { i32 } |
| 9 | %struct.signal_struct.3.15.123 = type { i64 } |
| 10 | %struct.pid.5.17.125 = type { i8* } |
| 11 | |
| 12 | ; Function Attrs: nounwind |
| 13 | define signext i32 @proc_task_getattr(%struct.inode.0.12.120* nocapture readonly %inode, %struct.kstat2.1.13.121* nocapture %stat) #0 { |
| 14 | entry: |
| 15 | %call1.i = tail call %struct.task_struct.4.16.124* @get_pid_task(%struct.pid.5.17.125* undef, i32 zeroext 0) #0 |
| 16 | br i1 undef, label %if.end, label %if.then |
| 17 | |
| 18 | if.then: ; preds = %entry |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 19 | %0 = load i64, i64* undef, align 8 |
Hal Finkel | c8cf2b8 | 2014-12-09 01:00:59 +0000 | [diff] [blame] | 20 | %conv.i = trunc i64 %0 to i32 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 21 | %1 = load i32, i32* null, align 4 |
Hal Finkel | c8cf2b8 | 2014-12-09 01:00:59 +0000 | [diff] [blame] | 22 | %add = add i32 %1, %conv.i |
| 23 | store i32 %add, i32* null, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 24 | %counter.i.i = getelementptr inbounds %struct.task_struct.4.16.124, %struct.task_struct.4.16.124* %call1.i, i64 0, i32 1, i32 0 |
Hal Finkel | c8cf2b8 | 2014-12-09 01:00:59 +0000 | [diff] [blame] | 25 | %2 = tail call i32 asm sideeffect "\09lwsync\0A1:\09lwarx\09$0,0,$1\09\09# atomic_dec_return\0A\09addic\09$0,$0,-1\0A\09stwcx.\09$0,0,$1\0A\09bne-\091b\0A\09sync\0A", "=&r,r,~{cr0},~{xer},~{memory}"(i32* %counter.i.i) #0 |
| 26 | %cmp.i = icmp eq i32 %2, 0 |
| 27 | br i1 %cmp.i, label %if.then.i, label %if.end |
| 28 | |
| 29 | ; CHECK-LABEL: @proc_task_getattr |
| 30 | ; CHECK-NOT: stwcx. [[REG:[0-9]+]],0,[[REG]] |
| 31 | ; CHECK: blr |
| 32 | |
| 33 | if.then.i: ; preds = %if.then |
| 34 | %3 = bitcast %struct.task_struct.4.16.124* %call1.i to i8* |
| 35 | tail call void @foo(i8* %3) #0 |
| 36 | unreachable |
| 37 | |
| 38 | if.end: ; preds = %if.then, %entry |
| 39 | ret i32 0 |
| 40 | } |
| 41 | |
| 42 | declare void @foo(i8*) |
| 43 | |
| 44 | declare %struct.task_struct.4.16.124* @get_pid_task(%struct.pid.5.17.125*, i32 zeroext) |
| 45 | |
| 46 | attributes #0 = { nounwind } |
| 47 | |