From abcaf8426944eb2f86c5e4d9f34c64f0e8f7ba41 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 10 Dec 2019 11:34:10 +0000 Subject: [PATCH] Update a previously-xfailed test The unfilled branch-delay slot no longer exists since we are emitting a conditional move now. Fixes https://github.com/CTSRD-CHERI/llvm-project/issues/290 --- .../bad-branch-delay-slot-usage-issue-290.c | 28 -------------- .../bad-branch-delay-slot-usage-issue-290.ll | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 28 deletions(-) delete mode 100644 llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.c create mode 100644 llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.ll diff --git a/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.c b/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.c deleted file mode 100644 index c54184ceb1b2..000000000000 --- a/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.c +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: %cheri_clang -S -o - -O2 %s -mllvm -debug-only="mips-delay-slot-filler" -mllvm -print-before="mips-delay-slot-filler" -mllvm -print-after="mips-delay-slot-filler" | FileCheck %s -// REQUIRES: asserts -// XFAIL: * -// https://github.com/CTSRD-CHERI/llvm-project/issues/290 - -int *__capability test(int *__capability inCap, int test, int inInt) { - int *__capability - ret = inCap; - if (test) { - ret += inInt + 4; - } - return ret; -} - -// CHECK-LABEL: # %bb.0: # %entry -// CHECK-NEXT: daddiu $sp, $sp, -16 -// CHECK-NEXT: sd $fp, 8($sp) # 8-byte Folded Spill -// CHECK-NEXT: beqz $4, .LBB0_2 -// CHECK-NEXT: move $fp, $sp -// CHECK-NEXT: # %bb.1: # %if.then -// CHECK-NEXT: addiu $1, $5, 4 -// CHECK-NEXT: dsll $1, $1, 2 -// CHECK-NEXT: cincoffset $c3, $c3, $1 -// CHECK-NEXT: .LBB0_2: # %if.end -// CHECK-NEXT: move $sp, $fp -// CHECK-NEXT: ld $fp, 8($sp) # 8-byte Folded Reload -// CHECK-NEXT: jr $ra -// CHECK-NEXT: daddiu $sp, $sp, 16 diff --git a/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.ll b/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.ll new file mode 100644 index 000000000000..11a2ae3413e1 --- /dev/null +++ b/llvm/test/CodeGen/Mips/cheri/bad-branch-delay-slot-usage-issue-290.ll @@ -0,0 +1,37 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +;; https://github.com/CTSRD-CHERI/llvm-project/issues/290 +;; This used to have an unfilled branch-delay slot but is ow converted to a conditional move +; RUN: %cheri128_purecap_llc %s -o - | FileCheck %s '-D#CAP_SIZE=16' + +; Function Attrs: norecurse nounwind readnone uwtable +define i32 addrspace(200)* @test(i32 addrspace(200)* readnone %inCap, i32 signext %test, i32 signext %inInt) local_unnamed_addr #0 { +; CHECK-LABEL: test: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: cincoffset $c11, $c11, -[[#STACKFRAME_SIZE:]] +; CHECK-NEXT: .cfi_def_cfa_offset [[#STACKFRAME_SIZE]] +; CHECK-NEXT: csc $c24, $zero, [[#STACKFRAME_SIZE - CAP_SIZE]]($c11) +; CHECK-NEXT: csc $c17, $zero, 0($c11) +; CHECK-NEXT: .cfi_offset 96, -[[#STACKFRAME_SIZE - CAP_SIZE]] +; CHECK-NEXT: .cfi_offset 89, -[[#CAP_SIZE * 2]] +; CHECK-NEXT: cincoffset $c24, $c11, $zero +; CHECK-NEXT: .cfi_def_cfa_register 96 +; CHECK-NEXT: addiu $1, $5, 4 +; CHECK-NEXT: dsll $1, $1, 2 +; CHECK-NEXT: cincoffset $c1, $c3, $1 +; CHECK-NEXT: cmovz $c1, $c3, $4 +; CHECK-NEXT: cmove $c3, $c1 +; CHECK-NEXT: cincoffset $c11, $c24, $zero +; CHECK-NEXT: clc $c17, $zero, 0($c11) +; CHECK-NEXT: clc $c24, $zero, [[#STACKFRAME_SIZE - CAP_SIZE]]($c11) +; CHECK-NEXT: cjr $c17 +; CHECK-NEXT: cincoffset $c11, $c11, [[#STACKFRAME_SIZE]] +entry: + %tobool = icmp eq i32 %test, 0 + %add = add nsw i32 %inInt, 4 + %idx.ext = sext i32 %add to i64 + %add.ptr = getelementptr inbounds i32, i32 addrspace(200)* %inCap, i64 %idx.ext + %ret.0 = select i1 %tobool, i32 addrspace(200)* %inCap, i32 addrspace(200)* %add.ptr + ret i32 addrspace(200)* %ret.0 +} + +attributes #0 = { norecurse nounwind readnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="cheri128" "target-features"="+cheri128,+chericap,+soft-float,-noabicalls" "unsafe-fp-math"="false" "use-soft-float"="true" }