xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/unalignedload.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mipsel -mcpu=mips32   -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EL,MIPS32-EL
2*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips   -mcpu=mips32   -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EB,MIPS32-EB
3*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mipsel -mcpu=mips32r2 -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EL,MIPS32-EL
4*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips   -mcpu=mips32r2 -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EB,MIPS32-EB
5*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mipsel -mcpu=mips32r6 -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EL,MIPS32R6-EL
6*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips   -mcpu=mips32r6 -relocation-model=pic | FileCheck %s -check-prefixes=ALL,ALL-EB,MIPS32R6-EB
7*9880d681SAndroid Build Coastguard Worker%struct.S2 = type { %struct.S1, %struct.S1 }
8*9880d681SAndroid Build Coastguard Worker%struct.S1 = type { i8, i8 }
9*9880d681SAndroid Build Coastguard Worker%struct.S4 = type { [7 x i8] }
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker@s2 = common global %struct.S2 zeroinitializer, align 1
12*9880d681SAndroid Build Coastguard Worker@s4 = common global %struct.S4 zeroinitializer, align 1
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine void @bar1() nounwind {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker; ALL-LABEL: bar1:
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; ALL-DAG:       lw $[[R0:[0-9]+]], %got(s2)(
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lbu $[[PART1:[0-9]+]], 2($[[R0]])
21*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lbu $[[PART2:[0-9]+]], 3($[[R0]])
22*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: sll $[[T0:[0-9]+]], $[[PART2]], 8
23*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: or  $4, $[[T0]], $[[PART1]]
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lbu $[[PART1:[0-9]+]], 2($[[R0]])
26*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lbu $[[PART2:[0-9]+]], 3($[[R0]])
27*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: sll $[[T0:[0-9]+]], $[[PART1]], 8
28*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: or  $[[T1:[0-9]+]], $[[T0]], $[[PART2]]
29*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: sll $4, $[[T1]], 16
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; MIPS32R6-DAG:  lhu $[[PART1:[0-9]+]], 2($[[R0]])
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker  tail call void @foo2(%struct.S1* byval getelementptr inbounds (%struct.S2, %struct.S2* @s2, i32 0, i32 1)) nounwind
34*9880d681SAndroid Build Coastguard Worker  ret void
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdefine void @bar2() nounwind {
38*9880d681SAndroid Build Coastguard Workerentry:
39*9880d681SAndroid Build Coastguard Worker; ALL-LABEL: bar2:
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; ALL-DAG:       lw $[[R2:[0-9]+]], %got(s4)(
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lwl $[[R1:4]], 3($[[R2]])
44*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lwr $[[R1]], 0($[[R2]])
45*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lbu $[[T0:[0-9]+]], 4($[[R2]])
46*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lbu $[[T1:[0-9]+]], 5($[[R2]])
47*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: lbu $[[T2:[0-9]+]], 6($[[R2]])
48*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: sll $[[T3:[0-9]+]], $[[T1]], 8
49*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: or  $[[T4:[0-9]+]], $[[T3]], $[[T0]]
50*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: sll $[[T5:[0-9]+]], $[[T2]], 16
51*9880d681SAndroid Build Coastguard Worker; MIPS32-EL-DAG: or  $5, $[[T4]], $[[T5]]
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lwl $[[R1:4]], 0($[[R2]])
54*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lwr $[[R1]], 3($[[R2]])
55*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lbu $[[T0:[0-9]+]], 4($[[R2]])
56*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lbu $[[T1:[0-9]+]], 5($[[R2]])
57*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: lbu $[[T2:[0-9]+]], 6($[[R2]])
58*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: sll $[[T3:[0-9]+]], $[[T0]], 8
59*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: or  $[[T4:[0-9]+]], $[[T3]], $[[T1]]
60*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: sll $[[T5:[0-9]+]], $[[T4]], 16
61*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: sll $[[T6:[0-9]+]], $[[T2]], 8
62*9880d681SAndroid Build Coastguard Worker; MIPS32-EB-DAG: or  $5, $[[T5]], $[[T6]]
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Worker; FIXME: We should be able to do better than this using lhu
65*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EL-DAG: lw $4, 0($[[R2]])
66*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EL-DAG: lhu $[[T0:[0-9]+]], 4($[[R2]])
67*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EL-DAG: lbu $[[T1:[0-9]+]], 6($[[R2]])
68*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EL-DAG: sll $[[T2:[0-9]+]], $[[T1]], 16
69*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EL-DAG: or  $5, $[[T0]], $[[T2]]
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker; FIXME: We should be able to do better than this using lhu
72*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: lw $4, 0($[[R2]])
73*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: lhu $[[T0:[0-9]+]], 4($[[R2]])
74*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: lbu $[[T1:[0-9]+]], 6($[[R2]])
75*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: sll $[[T2:[0-9]+]], $[[T0]], 16
76*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: sll $[[T3:[0-9]+]], $[[T1]], 8
77*9880d681SAndroid Build Coastguard Worker; MIPS32R6-EB-DAG: or  $5, $[[T2]], $[[T3]]
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Worker  tail call void @foo4(%struct.S4* byval @s4) nounwind
80*9880d681SAndroid Build Coastguard Worker  ret void
81*9880d681SAndroid Build Coastguard Worker}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Workerdeclare void @foo2(%struct.S1* byval)
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Workerdeclare void @foo4(%struct.S4* byval)
86