| Tilmann Scheller | 2d746bc | 2014-05-26 09:37:19 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s |
| 2 | |
| 3 | ; This file contains tests for the AArch64 load/store optimizer. |
| 4 | |
| 5 | %struct.A = type { %struct.B, %struct.C } |
| 6 | %struct.B = type { i8*, i8*, i8*, i8* } |
| 7 | %struct.C = type { i32, i32 } |
| 8 | |
| 9 | ; Check the following transform: |
| 10 | ; |
| 11 | ; ldr w1, [x0, #32] |
| 12 | ; ... |
| 13 | ; add x0, x0, #32 |
| 14 | ; -> |
| 15 | ; ldr w1, [x0, #32]! |
| Tilmann Scheller | 968d599 | 2014-05-26 09:40:40 +0000 | [diff] [blame^] | 16 | |
| Tilmann Scheller | 2d746bc | 2014-05-26 09:37:19 +0000 | [diff] [blame] | 17 | define void @foo(%struct.A* %ptr) nounwind { |
| 18 | ; CHECK-LABEL: foo |
| 19 | ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, #32]! |
| 20 | entry: |
| 21 | %a = getelementptr inbounds %struct.A* %ptr, i64 0, i32 1, i32 0 |
| 22 | %add = load i32* %a, align 4 |
| 23 | br label %bar |
| 24 | bar: |
| 25 | %c = getelementptr inbounds %struct.A* %ptr, i64 0, i32 1 |
| Tilmann Scheller | 968d599 | 2014-05-26 09:40:40 +0000 | [diff] [blame^] | 26 | tail call void @bar(%struct.C* %c, i32 %add) |
| Tilmann Scheller | 2d746bc | 2014-05-26 09:37:19 +0000 | [diff] [blame] | 27 | ret void |
| 28 | } |
| 29 | |
| 30 | declare void @bar(%struct.C*, i32) |
| 31 | |