llvm-project/llvm/test/CodeGen/Mips/lcb2.ll

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

372 lines
10 KiB
LLVM
Raw Normal View History

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -mattr=+soft-float -mips16-hard-float -relocation-model=static -mips16-constant-islands=true < %s | FileCheck %s -check-prefix=lcb
; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -mattr=+soft-float -mips16-hard-float -relocation-model=static -mips16-constant-islands=true < %s | FileCheck %s -check-prefix=lcbn
@i = global i32 0, align 4
@j = common global i32 0, align 4
@k = common global i32 0, align 4
; Function Attrs: nounwind optsize
define i32 @bnez() #0 {
; lcb-LABEL: bnez:
; lcb: # %bb.0: # %entry
; lcb-NEXT: li $2, %hi(i)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: lw $3, %lo(i)($2)
; lcb-NEXT: bnez $3, $BB0_2
; lcb-NEXT: # %bb.1: # %if.then
; lcb-NEXT: li $3, 0
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 10000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: sw $3, %lo(i)($2)
; lcb-NEXT: $BB0_2: # %if.end
; lcb-NEXT: li $2, 0
; lcb-NEXT: jrc $ra
;
; lcbn-LABEL: bnez:
; lcbn: # %bb.0: # %entry
; lcbn-NEXT: li $2, %hi(i)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: lw $3, %lo(i)($2)
; lcbn-NEXT: bnez $3, $BB0_2
; lcbn-NEXT: # %bb.1: # %if.then
; lcbn-NEXT: li $3, 0
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 10000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: sw $3, %lo(i)($2)
; lcbn-NEXT: $BB0_2: # %if.end
; lcbn-NEXT: li $2, 0
; lcbn-NEXT: jrc $ra
entry:
%0 = load i32, i32* @i, align 4, !tbaa !1
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void asm sideeffect ".space 10000", ""() #1, !srcloc !5
store i32 0, i32* @i, align 4, !tbaa !1
br label %if.end
if.end: ; preds = %if.then, %entry
ret i32 0
}
; Function Attrs: nounwind optsize
define i32 @beqz() #0 {
; lcb-LABEL: beqz:
; lcb: # %bb.0: # %entry
; lcb-NEXT: li $2, %hi(i)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: lw $2, %lo(i)($2)
; lcb-NEXT: beqz $2, $BB1_2
; lcb-NEXT: # %bb.1: # %if.else
; lcb-NEXT: li $2, %hi(j)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: li $3, 55
; lcb-NEXT: sw $3, %lo(j)($2)
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 10000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: b $BB1_3
; lcb-NEXT: $BB1_2: # %if.then
; lcb-NEXT: li $2, %hi(j)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: li $3, 10
; lcb-NEXT: sw $3, %lo(j)($2)
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 10000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: $BB1_3: # %if.end
; lcb-NEXT: li $2, 0
; lcb-NEXT: jrc $ra
;
; lcbn-LABEL: beqz:
; lcbn: # %bb.0: # %entry
; lcbn-NEXT: li $2, %hi(i)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: lw $2, %lo(i)($2)
; lcbn-NEXT: beqz $2, $BB1_2
; lcbn-NEXT: # %bb.1: # %if.else
; lcbn-NEXT: li $2, %hi(j)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: li $3, 55
; lcbn-NEXT: sw $3, %lo(j)($2)
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 10000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: b $BB1_3
; lcbn-NEXT: $BB1_2: # %if.then
; lcbn-NEXT: li $2, %hi(j)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: li $3, 10
; lcbn-NEXT: sw $3, %lo(j)($2)
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 10000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: $BB1_3: # %if.end
; lcbn-NEXT: li $2, 0
; lcbn-NEXT: jrc $ra
entry:
%0 = load i32, i32* @i, align 4, !tbaa !1
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
store i32 10, i32* @j, align 4, !tbaa !1
tail call void asm sideeffect ".space 10000", ""() #1, !srcloc !6
br label %if.end
if.else: ; preds = %entry
store i32 55, i32* @j, align 4, !tbaa !1
tail call void asm sideeffect ".space 10000", ""() #1, !srcloc !7
br label %if.end
if.end: ; preds = %if.else, %if.then
ret i32 0
}
; Function Attrs: nounwind optsize
define void @bteqz() #0 {
; lcb-LABEL: bteqz:
; lcb: # %bb.0: # %entry
; lcb-NEXT: li $2, %hi(j)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: lw $2, %lo(j)($2)
; lcb-NEXT: li $3, %hi(i)
; lcb-NEXT: sll $3, $3, 16
; lcb-NEXT: lw $3, %lo(i)($3)
; lcb-NEXT: cmp $3, $2
; lcb-NEXT: bteqz $BB2_2
; lcb-NEXT: # %bb.1: # %if.else
; lcb-NEXT: li $2, %hi(k)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 1000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: li $3, 2
; lcb-NEXT: sw $3, %lo(k)($2)
; lcb-NEXT: jrc $ra
; lcb-NEXT: $BB2_2: # %if.then
; lcb-NEXT: li $2, %hi(k)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: li $3, 1
; lcb-NEXT: sw $3, %lo(k)($2)
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 1000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: jrc $ra
;
; lcbn-LABEL: bteqz:
; lcbn: # %bb.0: # %entry
; lcbn-NEXT: li $2, %hi(j)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: lw $2, %lo(j)($2)
; lcbn-NEXT: li $3, %hi(i)
; lcbn-NEXT: sll $3, $3, 16
; lcbn-NEXT: lw $3, %lo(i)($3)
; lcbn-NEXT: cmp $3, $2
; lcbn-NEXT: bteqz $BB2_2
; lcbn-NEXT: # %bb.1: # %if.else
; lcbn-NEXT: li $2, %hi(k)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 1000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: li $3, 2
; lcbn-NEXT: sw $3, %lo(k)($2)
; lcbn-NEXT: jrc $ra
; lcbn-NEXT: $BB2_2: # %if.then
; lcbn-NEXT: li $2, %hi(k)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: li $3, 1
; lcbn-NEXT: sw $3, %lo(k)($2)
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 1000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: jrc $ra
entry:
%0 = load i32, i32* @i, align 4, !tbaa !1
%1 = load i32, i32* @j, align 4, !tbaa !1
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
store i32 1, i32* @k, align 4, !tbaa !1
tail call void asm sideeffect ".space 1000", ""() #1, !srcloc !8
br label %if.end
if.else: ; preds = %entry
tail call void asm sideeffect ".space 1000", ""() #1, !srcloc !9
store i32 2, i32* @k, align 4, !tbaa !1
br label %if.end
if.end: ; preds = %if.else, %if.then
ret void
}
; Function Attrs: nounwind optsize
define void @btz() #0 {
; lcb-LABEL: btz:
; lcb: # %bb.0: # %entry
; lcb-NEXT: li $2, %hi(i)
; lcb-NEXT: sll $2, $2, 16
; lcb-NEXT: lw $4, %lo(i)($2)
; lcb-NEXT: li $3, %hi(j)
; lcb-NEXT: sll $3, $3, 16
; lcb-NEXT: lw $5, %lo(j)($3)
; lcb-NEXT: slt $5, $4
; lcb-NEXT: bteqz $BB3_2
; lcb-NEXT: $BB3_1: # %if.then
; lcb-NEXT: # =>This Inner Loop Header: Depth=1
; lcb-NEXT: #APP
; lcb-NEXT: .set push
; lcb-NEXT: .set at
; lcb-NEXT: .set macro
; lcb-NEXT: .set reorder
; lcb-EMPTY:
; lcb-NEXT: .space 60000
; lcb-EMPTY:
; lcb-NEXT: .set pop
; lcb-NEXT: #NO_APP
; lcb-NEXT: lw $4, %lo(i)($2)
; lcb-NEXT: lw $5, %lo(j)($3)
; lcb-NEXT: slt $5, $4
; lcb-NEXT: btnez $BB3_1
; lcb-NEXT: $BB3_2: # %if.end
; lcb-NEXT: jrc $ra
;
; lcbn-LABEL: btz:
; lcbn: # %bb.0: # %entry
; lcbn-NEXT: li $2, %hi(i)
; lcbn-NEXT: sll $2, $2, 16
; lcbn-NEXT: lw $4, %lo(i)($2)
; lcbn-NEXT: li $3, %hi(j)
; lcbn-NEXT: sll $3, $3, 16
; lcbn-NEXT: lw $5, %lo(j)($3)
; lcbn-NEXT: slt $5, $4
; lcbn-NEXT: bteqz $BB3_2
; lcbn-NEXT: $BB3_1: # %if.then
; lcbn-NEXT: # =>This Inner Loop Header: Depth=1
; lcbn-NEXT: #APP
; lcbn-NEXT: .set push
; lcbn-NEXT: .set at
; lcbn-NEXT: .set macro
; lcbn-NEXT: .set reorder
; lcbn-EMPTY:
; lcbn-NEXT: .space 60000
; lcbn-EMPTY:
; lcbn-NEXT: .set pop
; lcbn-NEXT: #NO_APP
; lcbn-NEXT: lw $4, %lo(i)($2)
; lcbn-NEXT: lw $5, %lo(j)($3)
; lcbn-NEXT: slt $5, $4
; lcbn-NEXT: btnez $BB3_1
; lcbn-NEXT: $BB3_2: # %if.end
; lcbn-NEXT: jrc $ra
entry:
%0 = load i32, i32* @i, align 4, !tbaa !1
%1 = load i32, i32* @j, align 4, !tbaa !1
%cmp1 = icmp sgt i32 %0, %1
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %entry, %if.then
tail call void asm sideeffect ".space 60000", ""() #1, !srcloc !10
%2 = load i32, i32* @i, align 4, !tbaa !1
%3 = load i32, i32* @j, align 4, !tbaa !1
%cmp = icmp sgt i32 %2, %3
br i1 %cmp, label %if.then, label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
!llvm.ident = !{!0}
IR: Make metadata typeless in assembly Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!0 = !{!"clang version 3.5 (gitosis@dmz-portal.mips.com:clang.git ed197d08c90d82e1119774e10920e6f7a841c8ec) (gitosis@dmz-portal.mips.com:llvm.git b9235a363fa2dddb26ac01cbaed58efbc9eff392)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"int", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{i32 59}
!6 = !{i32 156}
!7 = !{i32 210}
!8 = !{i32 299}
!9 = !{i32 340}
!10 = !{i32 412}