Home | History | Annotate | Download | only in GlobalISel
      1 # RUN: llc -O0 -mtriple arm-linux -relocation-model=pic -mattr=+no-movt -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,ELF
      2 # RUN: llc -O0 -mtriple arm-linux -relocation-model=pic -mattr=-no-movt,+v8m -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,ELF
      3 # RUN: llc -O0 -mtriple arm-darwin -relocation-model=pic -mattr=+no-movt -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN-NOMOVT
      4 # RUN: llc -O0 -mtriple arm-darwin -relocation-model=pic -mattr=-no-movt,+v8m -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN-MOVT
      5 --- |
      6   @internal_global = internal global i32 42
      7   define void @test_internal_global() { ret void }
      8 
      9   @external_global = external global i32
     10   define void @test_external_global() { ret void }
     11 
     12   @internal_constant = internal constant i32 42
     13   define void @test_internal_constant() { ret void }
     14 
     15   @external_constant = external constant i32
     16   define void @test_external_constant() { ret void }
     17 ...
     18 ---
     19 name:            test_internal_global
     20 # CHECK-LABEL: name: test_internal_global
     21 legalized:       true
     22 regBankSelected: true
     23 selected:        false
     24 # CHECK: selected: true
     25 registers:
     26   - { id: 0, class: gprb }
     27   - { id: 1, class: gprb }
     28 body:             |
     29   bb.0:
     30     %0(p0) = G_GLOBAL_VALUE @internal_global
     31     ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel {{.*}}@internal_global
     32     ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_global
     33     ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_global
     34 
     35     %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_global)
     36     ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_global)
     37 
     38     $r0 = COPY %1(s32)
     39     ; CHECK: $r0 = COPY [[V]]
     40 
     41     BX_RET 14, $noreg, implicit $r0
     42     ; CHECK: BX_RET 14, $noreg, implicit $r0
     43 ...
     44 ---
     45 name:            test_external_global
     46 # CHECK-LABEL: name: test_external_global
     47 legalized:       true
     48 regBankSelected: true
     49 selected:        false
     50 # CHECK: selected: true
     51 registers:
     52   - { id: 0, class: gprb }
     53   - { id: 1, class: gprb }
     54 body:             |
     55   bb.0:
     56     %0(p0) = G_GLOBAL_VALUE @external_global
     57     ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel_ldr {{.*}} @external_global :: (load 4 from got)
     58     ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr {{.*}}@external_global :: (load 4 from got)
     59     ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr target-flags(arm-got) @external_global :: (load 4 from got)
     60 
     61     %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_global)
     62     ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_global)
     63 
     64     $r0 = COPY %1(s32)
     65     ; CHECK: $r0 = COPY [[V]]
     66 
     67     BX_RET 14, $noreg, implicit $r0
     68     ; CHECK: BX_RET 14, $noreg, implicit $r0
     69 ...
     70 ---
     71 name:            test_internal_constant
     72 # CHECK-LABEL: name: test_internal_constant
     73 legalized:       true
     74 regBankSelected: true
     75 selected:        false
     76 # CHECK: selected: true
     77 registers:
     78   - { id: 0, class: gprb }
     79   - { id: 1, class: gprb }
     80 body:             |
     81   bb.0:
     82     %0(p0) = G_GLOBAL_VALUE @internal_constant
     83     ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel {{.*}}@internal_constant
     84     ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_constant
     85     ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel {{.*}}@internal_constant
     86 
     87     %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_constant)
     88     ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_constant)
     89 
     90     $r0 = COPY %1(s32)
     91     ; CHECK: $r0 = COPY [[V]]
     92 
     93     BX_RET 14, $noreg, implicit $r0
     94     ; CHECK: BX_RET 14, $noreg, implicit $r0
     95 ...
     96 ---
     97 name:            test_external_constant
     98 # CHECK-LABEL: name: test_external_constant
     99 legalized:       true
    100 regBankSelected: true
    101 selected:        false
    102 # CHECK: selected: true
    103 registers:
    104   - { id: 0, class: gprb }
    105   - { id: 1, class: gprb }
    106 body:             |
    107   bb.0:
    108     %0(p0) = G_GLOBAL_VALUE @external_constant
    109     ; DARWIN-MOVT: [[G:%[0-9]+]]:gpr = MOV_ga_pcrel_ldr {{.*}} @external_constant :: (load 4 from got)
    110     ; DARWIN-NOMOVT: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr {{.*}}@external_constant :: (load 4 from got)
    111     ; ELF: [[G:%[0-9]+]]:gpr = LDRLIT_ga_pcrel_ldr target-flags(arm-got) @external_constant :: (load 4 from got)
    112 
    113     %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_constant)
    114     ; CHECK: [[V:%[0-9]+]]:gpr = LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_constant)
    115 
    116     $r0 = COPY %1(s32)
    117     ; CHECK: $r0 = COPY [[V]]
    118 
    119     BX_RET 14, $noreg, implicit $r0
    120     ; CHECK: BX_RET 14, $noreg, implicit $r0
    121 ...
    122