Use subword loads instead of a 4-byte load when the size of a structure (or a
[oota-llvm.git] / test / CodeGen / Mips / unalignedload.ll
1 ; RUN: llc  < %s -march=mipsel  | FileCheck %s -check-prefix=CHECK-EL
2 ; RUN: llc  < %s -march=mips    | FileCheck %s -check-prefix=CHECK-EB
3 %struct.S2 = type { %struct.S1, %struct.S1 }
4 %struct.S1 = type { i8, i8 }
5 %struct.S4 = type { [7 x i8] }
6
7 @s2 = common global %struct.S2 zeroinitializer, align 1
8 @s4 = common global %struct.S4 zeroinitializer, align 1
9
10 define void @foo1() nounwind {
11 entry:
12 ; CHECK-EL: lw  $25, %call16(foo2)
13 ; CHECK-EL: ulhu  $4, 2
14 ; CHECK-EL: lw  $[[R0:[0-9]+]], %got(s4)
15 ; CHECK-EL: lbu $[[R1:[0-9]+]], 6($[[R0]])
16 ; CHECK-EL: ulhu  $[[R2:[0-9]+]], 4($[[R0]])
17 ; CHECK-EL: sll $[[R3:[0-9]+]], $[[R1]], 16
18 ; CHECK-EL: ulw $4, 0($[[R0]])
19 ; CHECK-EL: lw  $25, %call16(foo4)
20 ; CHECK-EL: or  $5, $[[R2]], $[[R3]]
21
22 ; CHECK-EB: ulhu  $[[R0:[0-9]+]], 2
23 ; CHECK-EB: lw  $25, %call16(foo2)
24 ; CHECK-EB: sll $4, $[[R0]], 16
25 ; CHECK-EB: lw  $[[R1:[0-9]+]], %got(s4)
26 ; CHECK-EB: ulhu  $[[R2:[0-9]+]], 4($[[R1]])
27 ; CHECK-EB: lbu $[[R3:[0-9]+]], 6($[[R1]])
28 ; CHECK-EB: sll $[[R4:[0-9]+]], $[[R2]], 16
29 ; CHECK-EB: sll $[[R5:[0-9]+]], $[[R3]], 8
30 ; CHECK-EB: ulw $4, 0($[[R1]])
31 ; CHECK-EB: lw  $25, %call16(foo4)
32 ; CHECK-EB: or  $5, $[[R4]], $[[R5]]
33
34   tail call void @foo2(%struct.S1* byval getelementptr inbounds (%struct.S2* @s2, i32 0, i32 1)) nounwind
35   tail call void @foo4(%struct.S4* byval @s4) nounwind
36   ret void
37 }
38
39 declare void @foo2(%struct.S1* byval)
40
41 declare void @foo4(%struct.S4* byval)