File: relax-arith3.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (71 lines) | stat: -rw-r--r-- 2,726 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-objdump -d - | FileCheck  %s

// Test that we correctly relax these instructions into versions that use
// 16 or 32 bit immediate values.

bar:
// CHECK:      Disassembly of section imul:
// CHECK-EMPTY:
// CHECK-NEXT: <imul>:
// CHECK-NEXT:   0: 66 69 1d 00 00 00 00 00 00        imulw $0, (%rip), %bx
// CHECK-NEXT:   9: 69 1d 00 00 00 00 00 00 00 00     imull $0, (%rip), %ebx
// CHECK-NEXT:  13: 48 69 1d 00 00 00 00 00 00 00 00  imulq $0, (%rip), %rbx
        .section imul,"x"
        imul $foo, bar(%rip),  %bx
        imul $foo, bar(%rip),  %ebx
        imul $foo, bar(%rip),  %rbx


// CHECK:      <and>:
// CHECK-NEXT:   0: 66 81 25 00 00 00 00 00 00        andw $0, (%rip)
// CHECK-NEXT:   9: 81 25 00 00 00 00 00 00 00 00     andl $0, (%rip)
// CHECK-NEXT:  13: 48 81 25 00 00 00 00 00 00 00 00  andq $0, (%rip)
        .section and,"x"
        andw $foo, bar(%rip)
        andl $foo, bar(%rip)
        andq $foo, bar(%rip)

// CHECK:      <or>:
// CHECK-NEXT:   0: 66 81 0d 00 00 00 00 00 00        orw $0, (%rip)
// CHECK-NEXT:   9: 81 0d 00 00 00 00 00 00 00 00     orl $0, (%rip)
// CHECK-NEXT:  13: 48 81 0d 00 00 00 00 00 00 00 00  orq $0, (%rip)
        .section or,"x"
        orw $foo, bar(%rip)
        orl $foo, bar(%rip)
        orq $foo, bar(%rip)

// CHECK:      <xor>:
// CHECK-NEXT:   0: 66 81 35 00 00 00 00 00 00        xorw $0, (%rip)
// CHECK-NEXT:   9: 81 35 00 00 00 00 00 00 00 00     xorl $0, (%rip)
// CHECK-NEXT:  13: 48 81 35 00 00 00 00 00 00 00 00  xorq $0, (%rip)
        .section xor,"x"
        xorw $foo, bar(%rip)
        xorl $foo, bar(%rip)
        xorq $foo, bar(%rip)

// CHECK:      <add>:
// CHECK-NEXT:   0: 66 81 05 00 00 00 00 00 00        addw $0, (%rip)
// CHECK-NEXT:   9: 81 05 00 00 00 00 00 00 00 00     addl $0, (%rip)
// CHECK-NEXT:  13: 48 81 05 00 00 00 00 00 00 00 00  addq $0, (%rip)
        .section add,"x"
        addw $foo, bar(%rip)
        addl $foo, bar(%rip)
        addq $foo, bar(%rip)

// CHECK:      <sub>:
// CHECK-NEXT:   0: 66 81 2d 00 00 00 00 00 00        subw $0, (%rip)
// CHECK-NEXT:   9: 81 2d 00 00 00 00 00 00 00 00     subl $0, (%rip)
// CHECK-NEXT:  13: 48 81 2d 00 00 00 00 00 00 00 00  subq $0, (%rip)
        .section sub,"x"
        subw $foo, bar(%rip)
        subl $foo, bar(%rip)
        subq $foo, bar(%rip)

// CHECK:      <cmp>:
// CHECK-NEXT:   0: 66 81 3d 00 00 00 00 00 00        cmpw $0, (%rip)
// CHECK-NEXT:   9: 81 3d 00 00 00 00 00 00 00 00     cmpl $0, (%rip)
// CHECK-NEXT:  13: 48 81 3d 00 00 00 00 00 00 00 00  cmpq $0, (%rip)
        .section cmp,"x"
        cmpw $foo, bar(%rip)
        cmpl $foo, bar(%rip)
        cmpq $foo, bar(%rip)