Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
      2 
      3 @var32 = global i32 0
      4 @var64 = global i64 0
      5 
      6 define void @foo() {
      7 ; CHECK: foo:
      8     %val32 = load i32* @var32
      9     %val64 = load i64* @var64
     10 
     11     %val32_lit32 = and i32 %val32, 123456785
     12     store volatile i32 %val32_lit32, i32* @var32
     13 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     14 ; CHECK: ldr {{w[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     15 
     16     %val64_lit32 = and i64 %val64, 305402420
     17     store volatile i64 %val64_lit32, i64* @var64
     18 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     19 ; CHECK: ldr {{w[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     20 
     21     %val64_lit32signed = and i64 %val64, -12345678
     22     store volatile i64 %val64_lit32signed, i64* @var64
     23 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     24 ; CHECK: ldrsw {{x[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     25 
     26     %val64_lit64 = and i64 %val64, 1234567898765432
     27     store volatile i64 %val64_lit64, i64* @var64
     28 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI0_[0-9]+]]
     29 ; CHECK: ldr {{x[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     30 
     31     ret void
     32 }
     33 
     34 @varfloat = global float 0.0
     35 @vardouble = global double 0.0
     36 
     37 define void @floating_lits() {
     38 ; CHECK: floating_lits:
     39 
     40   %floatval = load float* @varfloat
     41   %newfloat = fadd float %floatval, 128.0
     42 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI1_[0-9]+]]
     43 ; CHECK: ldr {{s[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     44 ; CHECK: fadd
     45   store float %newfloat, float* @varfloat
     46 
     47   %doubleval = load double* @vardouble
     48   %newdouble = fadd double %doubleval, 129.0
     49 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI1_[0-9]+]]
     50 ; CHECK: ldr {{d[0-9]+}}, [x[[LITBASE]], #:lo12:[[CURLIT]]]
     51 ; CHECK: fadd
     52   store double %newdouble, double* @vardouble
     53 
     54   ret void
     55 }
     56