1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
3 ;; Test the ual feature which is similar to AArch64/arm64-strict-align.ll.
5 ; RUN: llc --mtriple=loongarch32 < %s | FileCheck %s --check-prefix=LA32-ALIGNED
6 ; RUN: llc --mtriple=loongarch32 --mattr=+ual < %s | FileCheck %s --check-prefix=LA32-UNALIGNED
7 ; RUN: llc --mtriple=loongarch32 --mattr=-ual < %s | FileCheck %s --check-prefix=LA32-ALIGNED
9 ; RUN: llc --mtriple=loongarch64 < %s | FileCheck %s --check-prefix=LA64-UNALIGNED
10 ; RUN: llc --mtriple=loongarch64 --mattr=+ual < %s | FileCheck %s --check-prefix=LA64-UNALIGNED
11 ; RUN: llc --mtriple=loongarch64 --mattr=-ual < %s | FileCheck %s --check-prefix=LA64-ALIGNED
13 define i32 @f0(ptr %p) nounwind {
14 ; LA32-ALIGNED-LABEL: f0:
15 ; LA32-ALIGNED: # %bb.0:
16 ; LA32-ALIGNED-NEXT: ld.hu $a1, $a0, 0
17 ; LA32-ALIGNED-NEXT: ld.hu $a0, $a0, 2
18 ; LA32-ALIGNED-NEXT: slli.w $a0, $a0, 16
19 ; LA32-ALIGNED-NEXT: or $a0, $a0, $a1
20 ; LA32-ALIGNED-NEXT: ret
22 ; LA32-UNALIGNED-LABEL: f0:
23 ; LA32-UNALIGNED: # %bb.0:
24 ; LA32-UNALIGNED-NEXT: ld.w $a0, $a0, 0
25 ; LA32-UNALIGNED-NEXT: ret
27 ; LA64-UNALIGNED-LABEL: f0:
28 ; LA64-UNALIGNED: # %bb.0:
29 ; LA64-UNALIGNED-NEXT: ld.w $a0, $a0, 0
30 ; LA64-UNALIGNED-NEXT: ret
32 ; LA64-ALIGNED-LABEL: f0:
33 ; LA64-ALIGNED: # %bb.0:
34 ; LA64-ALIGNED-NEXT: ld.hu $a1, $a0, 0
35 ; LA64-ALIGNED-NEXT: ld.h $a0, $a0, 2
36 ; LA64-ALIGNED-NEXT: slli.d $a0, $a0, 16
37 ; LA64-ALIGNED-NEXT: or $a0, $a0, $a1
38 ; LA64-ALIGNED-NEXT: ret
39 %tmp = load i32, ptr %p, align 2
43 define i64 @f1(ptr %p) nounwind {
44 ; LA32-ALIGNED-LABEL: f1:
45 ; LA32-ALIGNED: # %bb.0:
46 ; LA32-ALIGNED-NEXT: ld.w $a2, $a0, 0
47 ; LA32-ALIGNED-NEXT: ld.w $a1, $a0, 4
48 ; LA32-ALIGNED-NEXT: move $a0, $a2
49 ; LA32-ALIGNED-NEXT: ret
51 ; LA32-UNALIGNED-LABEL: f1:
52 ; LA32-UNALIGNED: # %bb.0:
53 ; LA32-UNALIGNED-NEXT: ld.w $a2, $a0, 0
54 ; LA32-UNALIGNED-NEXT: ld.w $a1, $a0, 4
55 ; LA32-UNALIGNED-NEXT: move $a0, $a2
56 ; LA32-UNALIGNED-NEXT: ret
58 ; LA64-UNALIGNED-LABEL: f1:
59 ; LA64-UNALIGNED: # %bb.0:
60 ; LA64-UNALIGNED-NEXT: ld.d $a0, $a0, 0
61 ; LA64-UNALIGNED-NEXT: ret
63 ; LA64-ALIGNED-LABEL: f1:
64 ; LA64-ALIGNED: # %bb.0:
65 ; LA64-ALIGNED-NEXT: ld.wu $a1, $a0, 0
66 ; LA64-ALIGNED-NEXT: ld.wu $a0, $a0, 4
67 ; LA64-ALIGNED-NEXT: slli.d $a0, $a0, 32
68 ; LA64-ALIGNED-NEXT: or $a0, $a0, $a1
69 ; LA64-ALIGNED-NEXT: ret
70 %tmp = load i64, ptr %p, align 4