Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
      2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -code-model=large | FileCheck --check-prefix=CHECK-LARGE %s
      3 
      4 @var32 = global i32 0
      5 @var64 = global i64 0
      6 
      7 define void @foo() {
      8 ; CHECK-LABEL: foo:
      9     %val32 = load i32* @var32
     10     %val64 = load i64* @var64
     11 
     12     %val32_lit32 = and i32 %val32, 123456785
     13     store volatile i32 %val32_lit32, i32* @var32
     14 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     15 ; CHECK: ldr {{w[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     16 
     17 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI0_[0-9]+]]
     18 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     19 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     20 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     21 ; CHECK-LARGE: ldr {{w[0-9]+}}, [x[[LITADDR]]]
     22 
     23     %val64_lit32 = and i64 %val64, 305402420
     24     store volatile i64 %val64_lit32, i64* @var64
     25 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     26 ; CHECK: ldr {{w[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     27 
     28 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI0_[0-9]+]]
     29 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     30 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     31 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     32 ; CHECK-LARGE: ldr {{w[0-9]+}}, [x[[LITADDR]]]
     33 
     34     %val64_lit32signed = and i64 %val64, -12345678
     35     store volatile i64 %val64_lit32signed, i64* @var64
     36 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     37 ; CHECK: ldrsw {{x[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     38 
     39 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI0_[0-9]+]]
     40 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     41 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     42 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     43 ; CHECK-LARGE: ldrsw {{x[0-9]+}}, [x[[LITADDR]]]
     44 
     45     %val64_lit64 = and i64 %val64, 1234567898765432
     46     store volatile i64 %val64_lit64, i64* @var64
     47 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     48 ; CHECK: ldr {{x[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     49 
     50 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI0_[0-9]+]]
     51 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     52 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     53 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     54 ; CHECK-LARGE: ldr {{x[0-9]+}}, [x[[LITADDR]]]
     55 
     56     ret void
     57 }
     58 
     59 @varfloat = global float 0.0
     60 @vardouble = global double 0.0
     61 
     62 define void @floating_lits() {
     63 ; CHECK-LABEL: floating_lits:
     64 
     65   %floatval = load float* @varfloat
     66   %newfloat = fadd float %floatval, 128.0
     67 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI1_[0-9]+]]
     68 ; CHECK: ldr {{s[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     69 ; CHECK: fadd
     70 
     71 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI1_[0-9]+]]
     72 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     73 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     74 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     75 ; CHECK-LARGE: ldr {{s[0-9]+}}, [x[[LITADDR]]]
     76 ; CHECK-LARGE: fadd
     77 
     78   store float %newfloat, float* @varfloat
     79 
     80   %doubleval = load double* @vardouble
     81   %newdouble = fadd double %doubleval, 129.0
     82 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI1_[0-9]+]]
     83 ; CHECK: ldr {{d[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     84 ; CHECK: fadd
     85 
     86 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g3:[[CURLIT:.LCPI1_[0-9]+]]
     87 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
     88 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
     89 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g0_nc:[[CURLIT]]
     90 ; CHECK-LARGE: ldr {{d[0-9]+}}, [x[[LITADDR]]]
     91 
     92   store double %newdouble, double* @vardouble
     93 
     94   ret void
     95 }
     96