QingShan Zhang | ecdab5b | 2018-12-18 06:32:42 +0000 | [diff] [blame] | 1 | ; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 <%s | FileCheck %s |
| 2 | |
| 3 | %struct.Record = type { %struct.Record*, i32 } |
| 4 | |
| 5 | @n = local_unnamed_addr global i32 500000000, align 4 |
| 6 | @m = common global %struct.Record zeroinitializer, align 8 |
| 7 | @a = hidden local_unnamed_addr global %struct.Record* @m, align 8 |
| 8 | @o = common global %struct.Record zeroinitializer, align 8 |
| 9 | @b = hidden local_unnamed_addr global %struct.Record* @o, align 8 |
| 10 | |
| 11 | define signext i32 @foo() local_unnamed_addr { |
| 12 | entry: |
| 13 | %0 = load i64, i64* bitcast (%struct.Record** @b to i64*), align 8 |
| 14 | %1 = load i64*, i64** bitcast (%struct.Record** @a to i64**), align 8 |
| 15 | store i64 %0, i64* %1, align 8 |
| 16 | %2 = load i32, i32* @n, align 4 |
| 17 | %cmp9 = icmp eq i32 %2, 0 |
| 18 | br i1 %cmp9, label %for.end, label %for.body |
| 19 | |
| 20 | for.body: ; preds = %entry, %for.body |
| 21 | %i.010 = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 22 | %3 = load %struct.Record*, %struct.Record** @a, align 8 |
| 23 | %IntComp = getelementptr inbounds %struct.Record, %struct.Record* %3, i64 0, i32 1 |
| 24 | store i32 5, i32* %IntComp, align 8 |
| 25 | %PtrComp2 = getelementptr inbounds %struct.Record, %struct.Record* %3, i64 0, i32 0 |
| 26 | %4 = load %struct.Record*, %struct.Record** %PtrComp2, align 8 |
| 27 | %IntComp3 = getelementptr inbounds %struct.Record, %struct.Record* %4, i64 0, i32 1 |
| 28 | store i32 5, i32* %IntComp3, align 8 |
| 29 | %PtrComp6 = getelementptr inbounds %struct.Record, %struct.Record* %4, i64 0, i32 0 |
| 30 | store %struct.Record* %4, %struct.Record** %PtrComp6, align 8 |
| 31 | %inc = add nuw i32 %i.010, 1 |
| 32 | %cmp = icmp ult i32 %inc, %2 |
| 33 | br i1 %cmp, label %for.body, label %for.end |
| 34 | |
| 35 | for.end: ; preds = %for.body, %entry |
| 36 | ret i32 0 |
| 37 | |
| 38 | ; CHECK-LABEL: foo |
| 39 | ; CHECK: addis [[REG1:[0-9]+]], 2, a@toc@ha |
| 40 | ; CHECK: li [[REG4:[0-9]+]], 5 |
| 41 | ; CHECK: [[LAB:[a-z0-9A-Z_.]+]]: |
| 42 | ; CHECK: ld [[REG2:[0-9]+]], a@toc@l([[REG1]]) |
QingShan Zhang | ecdab5b | 2018-12-18 06:32:42 +0000 | [diff] [blame] | 43 | ; CHECK: stw [[REG4]], 8([[REG2]]) |
QingShan Zhang | f24ec7b | 2019-01-03 05:04:18 +0000 | [diff] [blame] | 44 | ; CHECK: ld [[REG3:[0-9]+]], 0([[REG2]]) |
QingShan Zhang | ecdab5b | 2018-12-18 06:32:42 +0000 | [diff] [blame] | 45 | ; CHECK: stw [[REG4]], 8([[REG3]]) |
| 46 | ; CHECK: std [[REG3]], 0([[REG3]]) |
| 47 | ; CHECK: bdnz [[LAB]] |
| 48 | } |
| 49 | |