[PATCH] D20164: [mips] MIPS64R6 compact branch support

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 09:04:43 PDT 2016


dsanders requested changes to this revision.
dsanders added a comment.
This revision now requires changes to proceed.

The code change looks correct to me but there's some bugs in the test cases.


================
Comment at: test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll:17
@@ -14,2 +16,3 @@
 define internal void @_ZL14TestRemoveLastv(i32* %alist.sroa.0.4) {
+; CHECK-LABEL: _ZL14TestRemoveLastv
 entry:
----------------
It doesn't make much functional difference in this case but can you add a ':' so that we match the label instead of a nearby directive. Likewise for the other CHECK-LABEL's

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:6
@@ +5,3 @@
+entry:
+; PIC: jalrc $25
+  %call = tail call i64 @k()
----------------
The various checking directives can match in the wrong function at the moment. Could you add some CHECK-LABEL directives to prevent this?

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:11
@@ +10,3 @@
+  %cmp = icmp eq i64 %call, %call1
+; CHECK: bnec
+  br i1 %cmp, label %if.then, label %if.end
----------------
There aren't any RUN lines that enable the CHECK prefix (it's only the default when --check-prefix isn't given).

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:15-16
@@ +14,4 @@
+if.then:                                          ; preds = %entry:
+; STATIC: nop
+; STATIC: jal
+; PIC: jalrc $25
----------------
There aren't any RUN directives that specify the 'STATIC' prefix.

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:40
@@ +39,3 @@
+  %cmp = icmp eq i64 %call, %call1
+; CHECK beqc
+  br i1 %cmp, label %if.end, label %if.then
----------------
This one is missing a ':'

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:63
@@ +62,3 @@
+  %cmp = icmp slt i64 %call, 0
+; CHECK : bgez
+  br i1 %cmp, label %if.then, label %if.end
----------------
The whitespace between the 'CHECK' and ':' disables this check

================
Comment at: test/CodeGen/Mips/compactbranches/compact-branches-64.ll:187
@@ +186,3 @@
+  store i8* ()* %i, i8* ()** %i.addr, align 4
+; STATIC64: jal
+; STATIC64: nop
----------------
There are no RUN directives that enable STATIC64

================
Comment at: test/CodeGen/Mips/compactbranches/no-beqzc-bnezc.ll:10-57
@@ -6,47 +9,50 @@
 define i32 @f() {
 ; CHECK-LABEL: f
 ; CHECK-NOT:   bnezc $0
 
   %cmp = icmp eq i32 1, 1
   br i1 %cmp, label %if.then, label %if.end
 
   if.then:
     ret i32 1
 
   if.end:
     ret i32 0
 }
 
 define i32 @f1() {
 ; CHECK-LABEL: f1
 ; CHECK-NOT:   beqzc $0
 
   %cmp = icmp eq i32 0, 0
   br i1 %cmp, label %if.then, label %if.end
 
   if.then:
     ret i32 1
 
   if.end:
     ret i32 0
 }
 
 ; We silently fixup cases where the register allocator or user has given us
 ; an instruction with incorrect operands that is trivially acceptable.
 ; beqc and bnec have the restriction that $rs < $rt.
 
 define i32 @f2(i32 %a, i32 %b) {
 ; ENCODING-LABEL: f2
 ; ENCODING-NOT:   beqc $5, $4
 ; ENCODING-NOT:   bnec $5, $4
 
   %cmp = icmp eq i32 %b, %a
   br i1 %cmp, label %if.then, label %if.end
 
   if.then:
     ret i32 1
 
   if.end:
     ret i32 0
 }
 
+define i64 @f3() {
+; CHECK-LABEL: f
+; CHECK-NOT:   bnezc $0
----------------
This block isn't doing what you expect. It's checking that the two *-NOT's don't occur between the first two 'f' characters in the output. One of them will probably match the 'f' in the '.file' directive and it's quite likely that both occur before the 'f:' label on the first function

================
Comment at: test/CodeGen/Mips/compactbranches/no-beqzc-bnezc.ll:71
@@ +70,3 @@
+define i64 @f4() {
+; CHECK-LABEL: f1
+; CHECK-NOT:   beqzc $0
----------------
f1 -> f4

================
Comment at: test/CodeGen/Mips/compactbranches/no-beqzc-bnezc.ll:89
@@ +88,3 @@
+define i64 @f5(i64 %a, i64 %b) {
+; ENCODING-LABEL: f2
+; ENCODING-NOT:   beqc $5, $4
----------------
f2 -> f5


http://reviews.llvm.org/D20164





More information about the llvm-commits mailing list