Files
clang-p2996/llvm/test/CodeGen/RISCV/align-loops.ll
wangpc 61ab106f82 [RISCV] Add tune features of preferred function/loop align
D144048 has added preferred function and loop alignment to
RISCVSubtarget, but now we need to set them manually for
different processors.

Tune features that set preferred function/loop align to
[2, 64] bytes (align 1 is not here since the min align is 2)
are added. These features can be used in processor
definitions.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D157832
2023-08-15 12:04:12 +08:00

47 lines
1.4 KiB
LLVM

; RUN: llc < %s -mtriple=riscv64 | FileCheck %s
; RUN: llc < %s -mtriple=riscv64 -align-loops=16 | FileCheck %s -check-prefix=ALIGN_16
; RUN: llc < %s -mtriple=riscv64 -align-loops=32 | FileCheck %s -check-prefix=ALIGN_32
; RUN: llc < %s -mtriple=riscv64 -mattr=+pref-loop-align-16 | FileCheck %s -check-prefix=ALIGN_16
; RUN: llc < %s -mtriple=riscv64 -mattr=+pref-loop-align-32 | FileCheck %s -check-prefix=ALIGN_32
declare void @foo()
define void @test(i32 %n, i32 %m) nounwind {
; CHECK-LABEL: test:
; CHECK-NOT: .p2align
; CHECK: ret
; ALIGN_16-LABEL: test:
; ALIGN_16: .p2align 4{{$}}
; ALIGN_16-NEXT: .LBB0_1: # %outer
; ALIGN_16: .p2align 4{{$}}
; ALIGN_16-NEXT: .LBB0_2: # %inner
; ALIGN_32-LABEL: test:
; ALIGN_32: .p2align 5{{$}}
; ALIGN_32-NEXT: .LBB0_1: # %outer
; ALIGN_32: .p2align 5{{$}}
; ALIGN_32-NEXT: .LBB0_2: # %inner
entry:
br label %outer
outer:
%outer.iv = phi i32 [0, %entry], [%outer.iv.next, %outer_bb]
br label %inner
inner:
%inner.iv = phi i32 [0, %outer], [%inner.iv.next, %inner]
call void @foo()
%inner.iv.next = add i32 %inner.iv, 1
%inner.cond = icmp ne i32 %inner.iv.next, %m
br i1 %inner.cond, label %inner, label %outer_bb
outer_bb:
%outer.iv.next = add i32 %outer.iv, 1
%outer.cond = icmp ne i32 %outer.iv.next, %n
br i1 %outer.cond, label %outer, label %exit
exit:
ret void
}