diff options
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/ARM/jump-table-islands.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/Mips/nacl-align.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/switch-jump-table.ll | 54 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/switch.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/x86-shrink-wrapping.ll | 10 |
5 files changed, 57 insertions, 18 deletions
diff --git a/llvm/test/CodeGen/ARM/jump-table-islands.ll b/llvm/test/CodeGen/ARM/jump-table-islands.ll index 6b4f174c092..03d5a7d24ad 100644 --- a/llvm/test/CodeGen/ARM/jump-table-islands.ll +++ b/llvm/test/CodeGen/ARM/jump-table-islands.ll @@ -13,7 +13,7 @@ define %BigInt @test_moved_jumptable(i1 %tst, i32 %sw, %BigInt %l) { ; CHECK: .long LBB{{[0-9]+_[0-9]+}}-[[JUMP_TABLE]] ; CHECK: [[SKIP_TABLE]]: -; CHECK: add pc, {{r[0-9]+}}, {{r[0-9]+}} +; CHECK: add pc, lr, {{r[0-9]+}} br i1 %tst, label %simple, label %complex simple: diff --git a/llvm/test/CodeGen/Mips/nacl-align.ll b/llvm/test/CodeGen/Mips/nacl-align.ll index ec8f3f06afd..8191c7dec6f 100644 --- a/llvm/test/CodeGen/Mips/nacl-align.ll +++ b/llvm/test/CodeGen/Mips/nacl-align.ll @@ -44,18 +44,17 @@ default: ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: ; CHECK-NEXT: jr $ra ; CHECK-NEXT: addiu $2, $zero, 111 -; CHECK-NEXT: .align 4 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: ; CHECK-NEXT: jr $ra -; CHECK-NEXT: addiu $2, $zero, 222 +; CHECK-NEXT: addiu $2, $zero, 555 ; CHECK-NEXT: .align 4 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: ; CHECK-NEXT: jr $ra -; CHECK-NEXT: addiu $2, $zero, 333 +; CHECK-NEXT: addiu $2, $zero, 222 ; CHECK-NEXT: .align 4 ; CHECK-NEXT: ${{BB[0-9]+_[0-9]+}}: ; CHECK-NEXT: jr $ra -; CHECK-NEXT: addiu $2, $zero, 444 +; CHECK-NEXT: addiu $2, $zero, 333 } diff --git a/llvm/test/CodeGen/X86/switch-jump-table.ll b/llvm/test/CodeGen/X86/switch-jump-table.ll index a84fb4aafd1..5d190fe960b 100644 --- a/llvm/test/CodeGen/X86/switch-jump-table.ll +++ b/llvm/test/CodeGen/X86/switch-jump-table.ll @@ -1,17 +1,18 @@ -; RUN: llc -mtriple=i686-pc-gnu-linux < %s | FileCheck %s +; RUN: llc -mtriple=i686-pc-gnu-linux < %s | FileCheck %s -check-prefix=CHECK +; RUN: llc -mtriple=i686-pc-gnu-linux -print-machineinstrs=expand-isel-pseudos %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK-JT-WEIGHT ; An unreachable default destination is replaced with the most popular case label. -define void @sum2(i32 %x, i32* %to) { -; CHECK-LABEL: sum2: +define void @foo(i32 %x, i32* %to) { +; CHECK-LABEL: foo: ; CHECK: movl 4(%esp), [[REG:%e[a-z]{2}]] ; CHECK: cmpl $3, [[REG]] -; CHECK: jbe .LBB0_1 +; CHECK: ja .LBB0_6 +; CHECK-NEXT: # BB#1: +; CHECK-NEXT: jmpl *.LJTI0_0(,[[REG]],4) ; CHECK: movl $4 ; CHECK: retl -; CHECK-LABEL: .LBB0_1: -; CHECK-NEXT: jmpl *.LJTI0_0(,[[REG]],4) entry: switch i32 %x, label %default [ @@ -48,5 +49,44 @@ default: ; CHECK-NEXT: .long .LBB0_3 ; CHECK-NEXT: .long .LBB0_4 ; CHECK-NEXT: .long .LBB0_5 -; CHECK-NOT: .long } + +; Check if branch probabilities are correctly assigned to the jump table. + +define void @bar(i32 %x, i32* %to) { +; CHECK-JT-WEIGHT-LABEL: bar: +; CHECK-JT-WEIGHT: Successors according to CFG: BB#6(16) BB#8(96) +; CHECK-JT-WEIGHT: Successors according to CFG: BB#1(16) BB#2(16) BB#3(16) BB#4(16) BB#5(32) + +entry: + switch i32 %x, label %default [ + i32 0, label %bb0 + i32 1, label %bb1 + i32 2, label %bb2 + i32 3, label %bb3 + i32 4, label %bb4 + i32 5, label %bb4 + ], !prof !1 +bb0: + store i32 0, i32* %to + br label %exit +bb1: + store i32 1, i32* %to + br label %exit +bb2: + store i32 2, i32* %to + br label %exit +bb3: + store i32 3, i32* %to + br label %exit +bb4: + store i32 4, i32* %to + br label %exit +default: + store i32 5, i32* %to + br label %exit +exit: + ret void +} + +!1 = !{!"branch_weights", i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16} diff --git a/llvm/test/CodeGen/X86/switch.ll b/llvm/test/CodeGen/X86/switch.ll index d1222d04010..fdb148af487 100644 --- a/llvm/test/CodeGen/X86/switch.ll +++ b/llvm/test/CodeGen/X86/switch.ll @@ -90,7 +90,7 @@ return: ret void ; but with 6-8, the whole switch is suitable for a jump table. ; CHECK-LABEL: jt_is_better ; CHECK: cmpl $8 -; CHECK: jbe +; CHECK: ja ; CHECK: jmpq *.LJTI } diff --git a/llvm/test/CodeGen/X86/x86-shrink-wrapping.ll b/llvm/test/CodeGen/X86/x86-shrink-wrapping.ll index c6d20d5835d..9cfbf772bb3 100644 --- a/llvm/test/CodeGen/X86/x86-shrink-wrapping.ll +++ b/llvm/test/CodeGen/X86/x86-shrink-wrapping.ll @@ -532,7 +532,11 @@ declare hidden fastcc %struct.temp_slot* @find_temp_slot_from_address(%struct.rt ; ; CHECK: movl $24599, [[TMP2:%e[a-z]+]] ; CHECK-NEXT: btl [[TMP]], [[TMP2]] -; CHECK-NEXT: jb [[CLEANUP]] +; CHECK-NEXT: jae [[LOR_LHS_FALSE:LBB[0-9_]+]] +; +; CHECK: [[CLEANUP]]: ## %cleanup +; DISABLE: popq +; CHECK-NEXT: retq ; ; CHECK: [[LOR_LHS_FALSE]]: ## %lor.lhs.false ; CHECK: cmpl $134, %e[[BF_LOAD2]] @@ -551,10 +555,6 @@ declare hidden fastcc %struct.temp_slot* @find_temp_slot_from_address(%struct.rt ; CHECK-NEXT: je [[CLEANUP]] ; ; CHECK: movb $1, 57(%rax) -; -; CHECK: [[CLEANUP]]: ## %cleanup -; DISABLE: popq -; CHECK-NEXT: retq define void @useLEA(%struct.rtx_def* readonly %x) { entry: %cmp = icmp eq %struct.rtx_def* %x, null |