[llvm-commits] [llvm] r170719 - in /llvm/trunk/test/MC: ARM/AlignedBundling/ X86/AlignedBundling/

Eli Bendersky eliben at google.com
Thu Dec 20 11:07:30 PST 2012


Author: eliben
Date: Thu Dec 20 13:07:30 2012
New Revision: 170719

URL: http://llvm.org/viewvc/llvm-project?rev=170719&view=rev
Log:
Tests for the aligned bundling support added in r170718

Added:
    llvm/trunk/test/MC/ARM/AlignedBundling/
    llvm/trunk/test/MC/ARM/AlignedBundling/group-bundle-arm.s
    llvm/trunk/test/MC/ARM/AlignedBundling/lit.local.cfg
    llvm/trunk/test/MC/X86/AlignedBundling/
    llvm/trunk/test/MC/X86/AlignedBundling/align-mode-argument-error.s
    llvm/trunk/test/MC/X86/AlignedBundling/asm-printing-bundle-directives.s
    llvm/trunk/test/MC/X86/AlignedBundling/bundle-group-too-large-error.s
    llvm/trunk/test/MC/X86/AlignedBundling/different-sections.s
    llvm/trunk/test/MC/X86/AlignedBundling/lit.local.cfg
    llvm/trunk/test/MC/X86/AlignedBundling/lock-without-bundle-mode-error.s
    llvm/trunk/test/MC/X86/AlignedBundling/pad-bundle-groups.s
    llvm/trunk/test/MC/X86/AlignedBundling/relax-in-bundle-group.s
    llvm/trunk/test/MC/X86/AlignedBundling/single-inst-bundling.s
    llvm/trunk/test/MC/X86/AlignedBundling/switch-section-locked-error.s
    llvm/trunk/test/MC/X86/AlignedBundling/unlock-without-lock-error.s

Added: llvm/trunk/test/MC/ARM/AlignedBundling/group-bundle-arm.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/AlignedBundling/group-bundle-arm.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/AlignedBundling/group-bundle-arm.s (added)
+++ llvm/trunk/test/MC/ARM/AlignedBundling/group-bundle-arm.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,37 @@
+# RUN: llvm-mc -filetype=obj -triple armv7-linux-gnueabi %s -o - \
+# RUN:   | llvm-objdump -no-show-raw-insn -triple armv7 -disassemble - | FileCheck %s
+
+# On ARM each instruction is 4 bytes long so padding for individual
+# instructions should not be inserted. However, for bundle=locked groups
+# it can be.
+
+	.syntax unified
+	.text
+  .bundle_align_mode 4
+
+  bx lr
+  and r1, r1, r2
+  and r1, r1, r2
+  .bundle_lock
+  bx r9
+  bx r8
+  .bundle_unlock
+# CHECK:      c:  nop
+# CHECK-NEXT: 10: bx
+# CHECK-NEXT: 14: bx
+
+  # pow2 here
+  .align 4 
+  bx lr
+  .bundle_lock
+  bx r9
+  bx r9
+  bx r9
+  bx r8
+  .bundle_unlock
+# CHECK:      20: bx
+# CHECK-NEXT: 24: nop
+# CHECK-NEXT: 28: nop
+# CHECK-NEXT: 2c: nop
+# CHECK-NEXT: 30: bx
+

Added: llvm/trunk/test/MC/ARM/AlignedBundling/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/AlignedBundling/lit.local.cfg?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/AlignedBundling/lit.local.cfg (added)
+++ llvm/trunk/test/MC/ARM/AlignedBundling/lit.local.cfg Thu Dec 20 13:07:30 2012
@@ -0,0 +1,6 @@
+config.suffixes = ['.s']
+
+targets = set(config.root.targets_to_build.split())
+if not 'X86' in targets:
+    config.unsupported = True
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/align-mode-argument-error.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/align-mode-argument-error.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/align-mode-argument-error.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/align-mode-argument-error.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# Missing .bundle_align_mode argument
+# CHECK: error: unknown token
+
+  .bundle_align_mode
+  imull $17, %ebx, %ebp
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/asm-printing-bundle-directives.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/asm-printing-bundle-directives.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/asm-printing-bundle-directives.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/asm-printing-bundle-directives.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -filetype=asm -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# Just a simple test for the assembly emitter - making sure it emits back the
+# bundling directives.
+
+  .text
+foo:
+  .bundle_align_mode 4
+# CHECK:      .bundle_align_mode 4
+  pushq   %rbp
+  .bundle_lock
+# CHECK: .bundle_lock
+  cmpl    %r14d, %ebp
+  jle     .L_ELSE
+  .bundle_unlock
+# CHECK: .bundle_unlock
+
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/bundle-group-too-large-error.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/bundle-group-too-large-error.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/bundle-group-too-large-error.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/bundle-group-too-large-error.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,17 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# CHECK: ERROR: Fragment can't be larger than a bundle size
+
+  .text
+foo:
+  .bundle_align_mode 4
+  pushq   %rbp
+
+  .bundle_lock
+  pushq   %r14
+  callq   bar
+  callq   bar
+  callq   bar
+  callq   bar
+  .bundle_unlock
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/different-sections.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/different-sections.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/different-sections.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/different-sections.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,25 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
+# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
+
+# Test two different executable sections with bundling.
+
+  .bundle_align_mode 3
+  .section text1, "x"
+# CHECK: section text1
+  imull $17, %ebx, %ebp
+  imull $17, %ebx, %ebp
+
+  imull $17, %ebx, %ebp
+# CHECK:      6: nop
+# CHECK-NEXT: 8: imull
+
+  .section text2, "x"
+# CHECK: section text2
+  imull $17, %ebx, %ebp
+  imull $17, %ebx, %ebp
+
+  imull $17, %ebx, %ebp
+# CHECK:      6: nop
+# CHECK-NEXT: 8: imull
+
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/lit.local.cfg?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/lit.local.cfg (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/lit.local.cfg Thu Dec 20 13:07:30 2012
@@ -0,0 +1,6 @@
+config.suffixes = ['.s']
+
+targets = set(config.root.targets_to_build.split())
+if not 'X86' in targets:
+    config.unsupported = True
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/lock-without-bundle-mode-error.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/lock-without-bundle-mode-error.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/lock-without-bundle-mode-error.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/lock-without-bundle-mode-error.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,10 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# .bundle_lock can't come without a .bundle_align_mode before it
+
+# CHECK: ERROR: .bundle_lock forbidden when bundling is disabled
+
+  imull $17, %ebx, %ebp
+  .bundle_lock
+
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/pad-bundle-groups.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/pad-bundle-groups.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/pad-bundle-groups.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/pad-bundle-groups.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,46 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
+# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
+
+# Test some variations of padding for bundle-locked groups.
+
+  .text
+foo:
+  .bundle_align_mode 4
+
+# Each of these callq instructions is 5 bytes long
+  callq   bar
+  callq   bar
+
+  .bundle_lock
+  callq   bar
+  callq   bar
+  .bundle_unlock
+# We'll need a 6-byte NOP before this group
+# CHECK:        a:  nop
+# CHECK-NEXT:   10: callq
+# CHECK-NEXT:   15: callq
+
+  .bundle_lock
+  callq   bar
+  callq   bar
+  .bundle_unlock
+# Same here
+# CHECK:        1a:  nop
+# CHECK-NEXT:   20: callq
+# CHECK-NEXT:   25: callq
+
+  .align 16, 0x90
+  callq   bar
+  .bundle_lock
+  callq   bar
+  callq   bar
+  callq   bar
+  .bundle_unlock
+# And here we'll need a 11-byte NOP
+# CHECK:        30: callq
+# CHECK:        35: nop
+# CHECK-NEXT:   40: callq
+# CHECK-NEXT:   45: callq
+
+
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/relax-in-bundle-group.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/relax-in-bundle-group.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/relax-in-bundle-group.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/relax-in-bundle-group.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,42 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
+# RUN:   | llvm-objdump -disassemble - | FileCheck %s
+
+# Test that instructions inside bundle-locked groups are relaxed even if their
+# fixup is short enough not to warrant relaxation on its own.
+
+  .text
+foo:
+  .bundle_align_mode 4
+  pushq   %rbp
+
+  movl    %edi, %ebx
+  callq   bar
+  movl    %eax, %r14d
+  imull   $17, %ebx, %ebp
+  movl    %ebx, %edi
+  callq   bar
+  cmpl    %r14d, %ebp
+  .bundle_lock
+
+  jle     .L_ELSE
+# This group would've started at 0x18 and is too long, so a chunky NOP padding
+# is inserted to push it to 0x20.
+# CHECK: 18: {{[a-f0-9 ]+}} nopl
+
+# The long encoding for JLE should be used here even though its target is close
+# CHECK-NEXT: 20: 0f 8e
+
+  addl    %ebp, %eax
+
+  jmp     .L_RET
+# Same for the JMP
+# CHECK: 28: e9
+
+  .bundle_unlock
+
+.L_ELSE:
+  imull   %ebx, %eax
+.L_RET:
+
+  popq    %rbx
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/single-inst-bundling.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/single-inst-bundling.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/single-inst-bundling.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/single-inst-bundling.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,47 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
+# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
+
+# Test simple NOP insertion for single instructions.
+
+  .text
+foo:
+  # Will be bundle-aligning to 16 byte boundaries
+  .bundle_align_mode 4
+  pushq   %rbp
+  pushq   %r14
+  pushq   %rbx
+
+  movl    %edi, %ebx
+  callq   bar
+  movl    %eax, %r14d
+
+  imull   $17, %ebx, %ebp
+# This imull is 3 bytes long and should have started at 0xe, so two bytes
+# of nop padding are inserted instead and it starts at 0x10
+# CHECK:          nop
+# CHECK-NEXT:     10: imull
+
+  movl    %ebx, %edi
+  callq   bar
+  cmpl    %r14d, %ebp
+  jle     .L_ELSE
+# Due to the padding that's inserted before the addl, the jump target
+# becomes farther by one byte.
+# CHECK:         jle 5
+
+  addl    %ebp, %eax
+# CHECK:          nop
+# CHECK-NEXT:     20: addl
+
+  jmp     .L_RET
+.L_ELSE:
+  imull   %ebx, %eax
+.L_RET:
+  ret
+
+# Just sanity checking that data fills don't drive bundling crazy
+  .data
+  .byte 40
+  .byte 98
+
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/switch-section-locked-error.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/switch-section-locked-error.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/switch-section-locked-error.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/switch-section-locked-error.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# This test invokes .bundle_lock and then switches to a different section
+# w/o the appropriate unlock.
+
+# CHECK: ERROR: Unterminated .bundle_lock
+
+  .bundle_align_mode 3
+  .section text1, "x"
+  imull $17, %ebx, %ebp
+  .bundle_lock
+  imull $17, %ebx, %ebp
+
+  .section text2, "x"
+  imull $17, %ebx, %ebp
+

Added: llvm/trunk/test/MC/X86/AlignedBundling/unlock-without-lock-error.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/AlignedBundling/unlock-without-lock-error.s?rev=170719&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/AlignedBundling/unlock-without-lock-error.s (added)
+++ llvm/trunk/test/MC/X86/AlignedBundling/unlock-without-lock-error.s Thu Dec 20 13:07:30 2012
@@ -0,0 +1,11 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - |& FileCheck %s
+
+# .bundle_unlock can't come without a .bundle_lock before it
+
+# CHECK: ERROR: .bundle_unlock without matching lock
+
+  .bundle_align_mode 3
+  imull $17, %ebx, %ebp
+  .bundle_unlock
+
+





More information about the llvm-commits mailing list