Files
clang-p2996/llvm/test/CodeGen/LoongArch/preferred-alignments.ll
wanglei 9d4f7f44b6 [test][LoongArch] Add -mattr=+d option. NFC
Because most of tests assume target-abi=`lp64d`, adding the
corresponding feature is reasonable.

rg -l loongarch -g '!*.s' | xargs sed -i '/mtriple=loongarch/ {/-mattr=/!{/target-abi/! s/mtriple=loongarch.. /&-mattr=+d /}}'
2024-05-14 20:23:04 +08:00

48 lines
1.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck --check-prefix=LA464 %s
; RUN: llc --mtriple=loongarch64 -mattr=+d --mcpu=la464 < %s | FileCheck --check-prefix=LA464 %s
define signext i32 @sum(ptr noalias nocapture noundef readonly %0, i32 noundef signext %1) {
; LA464-LABEL: sum:
; LA464: # %bb.0:
; LA464-NEXT: ori $a2, $zero, 1
; LA464-NEXT: blt $a1, $a2, .LBB0_4
; LA464-NEXT: # %bb.1:
; LA464-NEXT: move $a2, $zero
; LA464-NEXT: bstrpick.d $a1, $a1, 31, 0
; LA464-NEXT: .p2align 4, , 16
; LA464-NEXT: .LBB0_2: # =>This Inner Loop Header: Depth=1
; LA464-NEXT: ld.w $a3, $a0, 0
; LA464-NEXT: add.w $a2, $a3, $a2
; LA464-NEXT: addi.d $a1, $a1, -1
; LA464-NEXT: addi.d $a0, $a0, 4
; LA464-NEXT: bnez $a1, .LBB0_2
; LA464-NEXT: # %bb.3:
; LA464-NEXT: move $a0, $a2
; LA464-NEXT: ret
; LA464-NEXT: .LBB0_4:
; LA464-NEXT: move $a2, $zero
; LA464-NEXT: move $a0, $a2
; LA464-NEXT: ret
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = phi i32 [ 0, %2 ], [ %13, %8 ]
ret i32 %7
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %14, %8 ]
%10 = phi i32 [ 0, %4 ], [ %13, %8 ]
%11 = getelementptr inbounds i32, ptr %0, i64 %9
%12 = load i32, ptr %11, align 4
%13 = add nsw i32 %12, %10
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %6, label %8
}