aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/X86/AlignedBundling
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-12-01 14:51:49 -0800
committerStephen Hines <srhines@google.com>2014-12-02 16:08:10 -0800
commit37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch)
tree8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /test/MC/X86/AlignedBundling
parentd2327b22152ced7bc46dc629fc908959e8a52d03 (diff)
downloadexternal_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'test/MC/X86/AlignedBundling')
-rw-r--r--test/MC/X86/AlignedBundling/labeloffset.s83
-rw-r--r--test/MC/X86/AlignedBundling/long-nop-pad.s2
-rw-r--r--test/MC/X86/AlignedBundling/nesting.s67
3 files changed, 151 insertions, 1 deletions
diff --git a/test/MC/X86/AlignedBundling/labeloffset.s b/test/MC/X86/AlignedBundling/labeloffset.s
new file mode 100644
index 0000000..65a0086
--- /dev/null
+++ b/test/MC/X86/AlignedBundling/labeloffset.s
@@ -0,0 +1,83 @@
+# RUN: llvm-mc -triple=i686-linux -filetype=obj %s -o - | \
+# RUN: llvm-objdump -disassemble -no-show-raw-insn -r - | FileCheck %s
+# RUN: llvm-mc -triple=i686-nacl -filetype=obj %s -o - | \
+# RUN: llvm-objdump -disassemble -no-show-raw-insn -r - | FileCheck %s
+
+ .bundle_align_mode 5
+ .text
+ .globl main
+ .align 32, 0x90
+ .type main,@function
+main: # @main
+# CHECK-LABEL: main:
+# Call + pop sequence for determining the PIC base.
+ .bundle_lock align_to_end
+ calll .L0$pb
+ .bundle_unlock
+.L0$pb:
+ popl %eax
+# CHECK: 20: popl
+# 26 bytes of instructions between the pop and the use of the pic base symbol.
+ movl $3, 2(%ebx, %ebx)
+ movl $3, 2(%ebx, %ebx)
+ movl $3, 2(%ebx, %ebx)
+ hlt
+ hlt
+# CHECK: nop
+.Ltmp0:
+ addl (.Ltmp0-.L0$pb), %eax
+# The addl has bundle padding to push it from 0x3b to 0x40.
+# The difference between the labels should be 0x20 (0x40-0x20) not 0x1b
+# (0x3b-0x20)
+# CHECK: 40: addl 32, %eax
+ popl %ecx
+ jmp *%ecx
+
+
+# Also make sure it works with a non-relaxable instruction (cmp vs add)
+# and for 2 adjacent labels that both point to the correct instruction
+ .section .text.bar, "ax"
+ .globl bar
+ .align 32, 0x90
+ .type bar,@function
+bar:
+# CHECK-LABEL: bar:
+ .bundle_lock align_to_end
+ calll .L1$pb
+ .bundle_unlock
+.L1$pb:
+ popl %eax
+# CHECK: 20: popl
+# 26 bytes of instructions between the pop and the use of the pic base symbol.
+ movl $3, 2(%ebx, %ebx)
+ movl $3, 2(%ebx, %ebx)
+ movl $3, 2(%ebx, %ebx)
+ hlt
+ hlt
+# CHECK: nop
+.Ltmp1:
+.Ltmp2:
+ cmpl %eax, .Ltmp1
+# CHECK: 40: cmpl %eax, 64
+ cmpl %eax, (.Ltmp2-.L1$pb)
+# CHECK: 46: cmpl %eax, 32
+ popl %ecx
+ jmp *%ecx
+
+
+# Switch sections in the middle of a function
+ .section .text.foo, "ax"
+ .globl foo
+ .align 32, 0x90
+ .type foo,@function
+# CHECK-LABEL: foo:
+foo:
+ inc %eax
+tmp3:
+ .rodata
+ .type obj,@object
+ .comm obj,4,4
+ .section .text.foo
+ inc %eax
+# CHECK: tmp3:
+# CHECK-NEXT: 1: incl
diff --git a/test/MC/X86/AlignedBundling/long-nop-pad.s b/test/MC/X86/AlignedBundling/long-nop-pad.s
index ea33e28..9b1ec11 100644
--- a/test/MC/X86/AlignedBundling/long-nop-pad.s
+++ b/test/MC/X86/AlignedBundling/long-nop-pad.s
@@ -14,7 +14,7 @@ foo:
# To align this group to a bundle end, we need a 15-byte NOP and a 12-byte NOP.
# CHECK: 0: nop
# CHECK-NEXT: f: nop
-# CHECK-NEXT: 1b: callq
+# CHECK: 1b: callq
# This push instruction is 1 byte long
.bundle_lock align_to_end
diff --git a/test/MC/X86/AlignedBundling/nesting.s b/test/MC/X86/AlignedBundling/nesting.s
new file mode 100644
index 0000000..8996170
--- /dev/null
+++ b/test/MC/X86/AlignedBundling/nesting.s
@@ -0,0 +1,67 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
+# RUN: | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
+
+# Will be bundle-aligning to 16 byte boundaries
+ .bundle_align_mode 4
+ .text
+# CHECK-LABEL: foo
+foo:
+# Test that bundle alignment mode can be set more than once.
+ .bundle_align_mode 4
+# Each of these callq instructions is 5 bytes long
+ callq bar
+ callq bar
+ .bundle_lock
+ .bundle_lock
+ callq bar
+ callq bar
+ .bundle_unlock
+ .bundle_unlock
+# CHECK: 10: callq
+# CHECK-NEXT: 15: callq
+
+ .p2align 4
+# CHECK-LABEL: bar
+bar:
+ callq foo
+ callq foo
+# Check that the callqs get bundled together, and that the whole group is
+# align_to_end
+ .bundle_lock
+ callq bar
+ .bundle_lock align_to_end
+ callq bar
+ .bundle_unlock
+ .bundle_unlock
+# CHECK: 36: callq
+# CHECK-NEXT: 3b: callq
+
+# CHECK-LABEL: baz
+baz:
+ callq foo
+ callq foo
+# Check that the callqs get bundled together, and that the whole group is
+# align_to_end (with the outer directive marked align_to_end)
+ .bundle_lock align_to_end
+ callq bar
+ .bundle_lock
+ callq bar
+ .bundle_unlock
+ .bundle_unlock
+# CHECK: 56: callq
+# CHECK-NEXT: 5b: callq
+
+# CHECK-LABEL: quux
+quux:
+ callq bar
+ callq bar
+ .bundle_lock
+ .bundle_lock
+ callq bar
+ .bundle_unlock
+ callq bar
+ .bundle_unlock
+# Check that the calls are bundled together when the second one is after the
+# inner nest is closed.
+# CHECK: 70: callq
+# CHECK-NEXT: 75: callq