[PATCH] Implement srem, urem in Mips fast-isel

Daniel Sanders daniel.sanders at imgtec.com
Tue May 12 05:06:45 PDT 2015


LGTM. There are some comments for the big cleanup at the end of this series.


================
Comment at: lib/Target/Mips/MipsFastISel.cpp:1526-1527
@@ +1525,4 @@
+  MVT DestVT = DestEVT.getSimpleVT();
+  if (DestVT != MVT::i32)
+    return false;
+  unsigned DivOpc;
----------------
The generated code is valid for all integers <=32-bit so long as operands are sign/zero extended properly by all relevant instructions.

I don't think we can guarantee that so this is something for the big cleanup once we've finished this set of patches.

================
Comment at: test/CodeGen/Mips/Fast-ISel/rem1.ll:14
@@ +13,3 @@
+entry:
+; CHECK-LABEL: 	.ent	rems 
+  %0 = load i32* @sj, align 4
----------------
As mentioned in D6774, we can significantly simplify this using arguments and returns.

As noted there, I don't mind if this is part of the big cleanup.

================
Comment at: test/CodeGen/Mips/Fast-ISel/rem1.ll:58-99
@@ +57,43 @@
+}
+
+; Function Attrs: nounwind
+define i32 @main() #1 {
+entry:
+  %retval = alloca i32, align 4
+  store i32 0, i32* %retval
+  call void @rems()
+  call void @remu()
+  %0 = load i32* @si, align 4
+  %cmp = icmp ne i32 %0, 12
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:                                          ; preds = %entry
+  call void @abort() #3
+  unreachable
+
+if.end:                                           ; preds = %entry
+  %1 = load i32* @ui, align 4
+  %cmp1 = icmp ne i32 %1, 28
+  br i1 %cmp1, label %if.then2, label %if.end3
+
+if.then2:                                         ; preds = %if.end
+  call void @abort() #3
+  unreachable
+
+if.end3:                                          ; preds = %if.end
+  ret i32 0
+}
+
+; Function Attrs: noreturn
+declare void @abort() #2
+
+attributes #0 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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 "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { noreturn "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #3 = { noreturn }
+
+!llvm.module.flags = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 1, !"PIC Level", i32 2}
+!1 = !{!"clang version 3.7.0 (gitosis at dmz-portal.mips.com:clang.git 9b0d3553724b8a381c74d439cd4ff393c91dc484) (gitosis at dmz-portal.mips.com:llvm.git bbf9cc75cee50d9bed53aac1aa874711323af1ea)"}
----------------
Unnecessary

http://reviews.llvm.org/D7027

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list