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

Unified Diff: test/NaCl/PNaClABI/abi-arithmetic-attributes.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « test/NaCl/PNaClABI/abi-alignment.ll ('k') | test/NaCl/PNaClABI/abi-atomics.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/PNaClABI/abi-arithmetic-attributes.ll
diff --git a/test/NaCl/PNaClABI/abi-arithmetic-attributes.ll b/test/NaCl/PNaClABI/abi-arithmetic-attributes.ll
new file mode 100644
index 0000000000000000000000000000000000000000..6be379b104a140ce206a139a1c80fd319688adbf
--- /dev/null
+++ b/test/NaCl/PNaClABI/abi-arithmetic-attributes.ll
@@ -0,0 +1,41 @@
+; RUN: not pnacl-abicheck < %s | FileCheck %s
+
+; This tests that the arithmetic attributes "nuw" and "nsw" ("no
+; unsigned wrap" and "no signed wrap") and "exact" are disallowed by
+; the PNaCl ABI verifier.
+
+define internal void @allowed_cases() {
+ %add = add i32 1, 2
+ %shl = shl i32 3, 4
+ %udiv = udiv i32 4, 2
+ %lshr = lshr i32 2, 1
+ %ashr = ashr i32 2, 1
+ ret void
+}
+; CHECK-NOT: disallowed
+
+
+define internal void @rejected_cases() {
+ %add = add nsw i32 1, 2
+; CHECK: disallowed: has "nsw" attribute: %add
+ %shl1 = shl nuw i32 3, 4
+; CHECK-NEXT: disallowed: has "nuw" attribute: %shl1
+ %sub = sub nsw nuw i32 5, 6
+; CHECK-NEXT: disallowed: has "nuw" attribute: %sub
+
+ %lshr = lshr exact i32 2, 1
+; CHECK-NEXT: disallowed: has "exact" attribute: %lshr
+ %ashr = ashr exact i32 2, 1
+; CHECK-NEXT: disallowed: has "exact" attribute: %ashr
+ %udiv = udiv exact i32 4, 2
+; CHECK-NEXT: disallowed: has "exact" attribute: %udiv
+
+ ret void
+}
+; CHECK-NOT: disallowed
+
+
+; This stops the verifier from complaining about the lack of an entry point.
+define void @_start(i32 %arg) {
+ ret void
+}
« no previous file with comments | « test/NaCl/PNaClABI/abi-alignment.ll ('k') | test/NaCl/PNaClABI/abi-atomics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698