Jacques Pienaar | d96f8a3 | 2016-04-20 18:28:55 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -mtriple=lanai-unknown-unknown | FileCheck %s |
| 2 | |
| 3 | ; Test scheduling of subwords. |
| 4 | |
| 5 | %struct.X = type { i16, i16 } |
| 6 | |
| 7 | define void @f(%struct.X* inreg nocapture %c) #0 { |
| 8 | entry: |
| 9 | %a = getelementptr inbounds %struct.X, %struct.X* %c, i32 0, i32 0 |
| 10 | %0 = load i16, i16* %a, align 2 |
| 11 | %inc = add i16 %0, 1 |
| 12 | store i16 %inc, i16* %a, align 2 |
| 13 | %b = getelementptr inbounds %struct.X, %struct.X* %c, i32 0, i32 1 |
| 14 | %1 = load i16, i16* %b, align 2 |
| 15 | %dec = add i16 %1, -1 |
| 16 | store i16 %dec, i16* %b, align 2 |
| 17 | ret void |
| 18 | } |
| 19 | |
| 20 | ; Verify that the two loads occur before the stores. Without memory |
| 21 | ; disambiguation and subword schedule, the resultant code was a per subword |
| 22 | ; load-modify-store sequence instead of the more optimal schedule where all |
| 23 | ; loads occurred before modification and storage. |
| 24 | ; CHECK: uld.h |
| 25 | ; CHECK-NEXT: uld.h |
| 26 | ; CHECK-NEXT: add |
| 27 | ; CHECK-NEXT: st.h |
| 28 | ; CHECK-NEXT: sub |
| 29 | ; CHECK-NEXT: st.h |