Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: tests_lit/llvm2ice_tests/sdiv.ll

Issue 443203003: Subzero: Use scalar arithmetic when no vector instruction exists. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: TODO(stichnot) Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/vector-arith.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/sdiv.ll
diff --git a/tests_lit/llvm2ice_tests/sdiv.ll b/tests_lit/llvm2ice_tests/sdiv.ll
new file mode 100644
index 0000000000000000000000000000000000000000..ec43d6a294b8ccdbdd68653a4b5d78e7e484cf1e
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/sdiv.ll
@@ -0,0 +1,82 @@
+; This checks the correctness of the lowering code for the small
+; integer variants of sdiv and srem.
+
+; RUN: %llvm2ice --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -O2 --verbose none %s \
+; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -Om1 --verbose none %s \
+; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
+; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
+; RUN: | FileCheck --check-prefix=DUMP %s
+
+define i32 @sdiv_i8(i32 %a.i32, i32 %b.i32) {
+entry:
+ %a = trunc i32 %a.i32 to i8
+ %b = trunc i32 %b.i32 to i8
+ %res = sdiv i8 %a, %b
+ %res.i32 = zext i8 %res to i32
+ ret i32 %res.i32
+; CHECK-LABEL: sdiv_i8:
+; CHECK: cbw
+; CHECK: idiv
+}
+
+define i32 @sdiv_i16(i32 %a.i32, i32 %b.i32) {
+entry:
+ %a = trunc i32 %a.i32 to i16
+ %b = trunc i32 %b.i32 to i16
+ %res = sdiv i16 %a, %b
+ %res.i32 = zext i16 %res to i32
+ ret i32 %res.i32
+; CHECK-LABEL: sdiv_i16:
+; CHECK: cwd
+; CHECK: idiv
+}
+
+define i32 @sdiv_i32(i32 %a, i32 %b) {
+entry:
+ %res = sdiv i32 %a, %b
+ ret i32 %res
+; CHECK-LABEL: sdiv_i32:
+; CHECK: cdq
+; CHECK: idiv
+}
+
+define i32 @srem_i8(i32 %a.i32, i32 %b.i32) {
+entry:
+ %a = trunc i32 %a.i32 to i8
+ %b = trunc i32 %b.i32 to i8
+ %res = srem i8 %a, %b
+ %res.i32 = zext i8 %res to i32
+ ret i32 %res.i32
+; CHECK-LABEL: srem_i8:
+; CHECK: cbw
+; CHECK: idiv
+}
+
+define i32 @srem_i16(i32 %a.i32, i32 %b.i32) {
+entry:
+ %a = trunc i32 %a.i32 to i16
+ %b = trunc i32 %b.i32 to i16
+ %res = srem i16 %a, %b
+ %res.i32 = zext i16 %res to i32
+ ret i32 %res.i32
+; CHECK-LABEL: srem_i16:
+; CHECK: cwd
+; CHECK: idiv
+}
+
+define i32 @srem_i32(i32 %a, i32 %b) {
+entry:
+ %res = srem i32 %a, %b
+ ret i32 %res
+; CHECK-LABEL: srem_i32:
+; CHECK: cdq
+; CHECK: idiv
+}
+
+; ERRORS-NOT: ICE translation error
+; DUMP-NOT: SZ
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/vector-arith.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698