aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/X86/add-trick32.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/X86/add-trick32.ll')
-rw-r--r--test/CodeGen/X86/add-trick32.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGen/X86/add-trick32.ll b/test/CodeGen/X86/add-trick32.ll
new file mode 100644
index 0000000..42909b4
--- /dev/null
+++ b/test/CodeGen/X86/add-trick32.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=x86 > %t
+; RUN: not grep add %t
+; RUN: grep subl %t | count 1
+
+; The immediate can be encoded in a smaller way if the
+; instruction is a sub instead of an add.
+
+define i32 @foo(i32 inreg %a) nounwind {
+ %b = add i32 %a, 128
+ ret i32 %b
+}