Home | History | Annotate | Download | only in ARM
      1 @ This test has a partner (ltorg.s) that contains matching
      2 @ tests for the .ltorg on linux targets. We need separate files
      3 @ because the syntax for switching sections and temporary labels differs
      4 @ between darwin and linux. Any tests added here should have a matching
      5 @ test added there.
      6 
      7 @RUN: llvm-mc -triple   armv7-apple-darwin %s | FileCheck %s
      8 @RUN: llvm-mc -triple thumbv5-apple-darwin %s | FileCheck %s
      9 @RUN: llvm-mc -triple thumbv7-apple-darwin %s | FileCheck %s
     10 
     11 @ check that ltorg dumps the constant pool at the current location
     12 .section __TEXT,a,regular,pure_instructions
     13 @ CHECK-LABEL: f2:
     14 f2:
     15   ldr r0, =0x10002
     16 @ CHECK: ldr r0, Ltmp0
     17   adds r0, r0, #1
     18   adds r0, r0, #1
     19   b f3
     20 .ltorg
     21 @ constant pool
     22 @ CHECK: .data_region
     23 @ CHECK: .p2align 2
     24 @ CHECK-LABEL: Ltmp0:
     25 @ CHECK: .long 65538
     26 @ CHECK: .end_data_region
     27 
     28 @ CHECK-LABEL: f3:
     29 f3:
     30   adds r0, r0, #1
     31   adds r0, r0, #1
     32 
     33 @ check that ltorg clears the constant pool after dumping it
     34 .section __TEXT,b,regular,pure_instructions
     35 @ CHECK-LABEL: f4:
     36 f4:
     37   ldr r0, =0x10003
     38 @ CHECK: ldr r0, Ltmp1
     39   adds r0, r0, #1
     40   adds r0, r0, #1
     41   b f5
     42 .ltorg
     43 @ constant pool
     44 @ CHECK: .data_region
     45 @ CHECK: .p2align 2
     46 @ CHECK-LABEL: Ltmp1:
     47 @ CHECK: .long 65539
     48 @ CHECK: .end_data_region
     49 
     50 @ CHECK-LABEL: f5:
     51 f5:
     52   adds r0, r0, #1
     53   adds r0, r0, #1
     54   ldr r0, =0x10004
     55 @ CHECK: ldr r0, Ltmp2
     56   adds r0, r0, #1
     57   b f6
     58 .ltorg
     59 @ constant pool
     60 @ CHECK: .data_region
     61 @ CHECK: .p2align 2
     62 @ CHECK-LABEL: Ltmp2:
     63 @ CHECK: .long 65540
     64 @ CHECK: .end_data_region
     65 
     66 @ CHECK-LABEL: f6:
     67 f6:
     68   adds r0, r0, #1
     69   adds r0, r0, #1
     70 
     71 @ check that ltorg does not issue an error if there is no constant pool
     72 .section __TEXT,c,regular,pure_instructions
     73 @ CHECK-LABEL: f7:
     74 f7:
     75   adds r0, r0, #1
     76   b f8
     77   .ltorg
     78 f8:
     79   adds r0, r0, #1
     80 
     81 @ check that ltorg works for labels
     82 .section __TEXT,d,regular,pure_instructions
     83 @ CHECK-LABEL: f9:
     84 f9:
     85   adds r0, r0, #1
     86   adds r0, r0, #1
     87   ldr r0, =bar
     88 @ CHECK: ldr r0, Ltmp3
     89   adds r0, r0, #1
     90   adds r0, r0, #1
     91   adds r0, r0, #1
     92   b f10
     93 .ltorg
     94 @ constant pool
     95 @ CHECK: .data_region
     96 @ CHECK: .p2align 2
     97 @ CHECK-LABEL: Ltmp3:
     98 @ CHECK: .long bar
     99 @ CHECK: .end_data_region
    100 
    101 @ CHECK-LABEL: f10:
    102 f10:
    103   adds r0, r0, #1
    104   adds r0, r0, #1
    105 
    106 @ check that use of ltorg does not prevent dumping non-empty constant pools at end of section
    107 .section __TEXT,e,regular,pure_instructions
    108 @ CHECK-LABEL: f11:
    109 f11:
    110   adds r0, r0, #1
    111   adds r0, r0, #1
    112   ldr r0, =0x10005
    113 @ CHECK: ldr r0, Ltmp4
    114   b f12
    115   .ltorg
    116 @ constant pool
    117 @ CHECK: .data_region
    118 @ CHECK: .p2align 2
    119 @ CHECK-LABEL: Ltmp4:
    120 @ CHECK: .long 65541
    121 @ CHECK: .end_data_region
    122 
    123 @ CHECK-LABEL: f12:
    124 f12:
    125   adds r0, r0, #1
    126   ldr r0, =0x10006
    127 @ CHECK: ldr r0, Ltmp5
    128 
    129 .section __TEXT,f,regular,pure_instructions
    130 @ CHECK-LABEL: f13
    131 f13:
    132   adds r0, r0, #1
    133   adds r0, r0, #1
    134 
    135 @ should not have a constant pool at end of section with empty constant pools
    136 @ CHECK-NOT: .section __TEXT,a,regular,pure_instructions
    137 @ CHECK-NOT: .section __TEXT,b,regular,pure_instructions
    138 @ CHECK-NOT: .section __TEXT,c,regular,pure_instructions
    139 @ CHECK-NOT: .section __TEXT,d,regular,pure_instructions
    140 
    141 @ should have a non-empty constant pool at end of this section
    142 @ CHECK: .section __TEXT,e,regular,pure_instructions
    143 @ constant pool
    144 @ CHECK: .data_region
    145 @ CHECK: .p2align 2
    146 @ CHECK-LABEL: Ltmp5:
    147 @ CHECK: .long 65542
    148 @ CHECK: .end_data_region
    149 
    150 @ should not have a constant pool at end of section with empty constant pools
    151 @ CHECK-NOT: .section __TEXT,f,regular,pure_instructions
    152