Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s
      2 
      3 %struct.foo = type { i32, i64, float, double }
      4 
      5 define double* @test_struct(%struct.foo* %f) {
      6 ; CHECK-LABEL: test_struct
      7 ; CHECK:       add x0, x0, #24
      8   %1 = getelementptr inbounds %struct.foo, %struct.foo* %f, i64 0, i32 3
      9   ret double* %1
     10 }
     11 
     12 define i32* @test_array1(i32* %a, i64 %i) {
     13 ; CHECK-LABEL: test_array1
     14 ; CHECK:       orr [[REG:x[0-9]+]], xzr, #0x4
     15 ; CHECK-NEXT:  madd  x0, x1, [[REG]], x0
     16   %1 = getelementptr inbounds i32, i32* %a, i64 %i
     17   ret i32* %1
     18 }
     19 
     20 define i32* @test_array2(i32* %a) {
     21 ; CHECK-LABEL: test_array2
     22 ; CHECK:       add  x0, x0, #16
     23   %1 = getelementptr inbounds i32, i32* %a, i64 4
     24   ret i32* %1
     25 }
     26 
     27 define i32* @test_array3(i32* %a) {
     28 ; CHECK-LABEL: test_array3
     29 ; CHECK:       add x0, x0, #1, lsl #12
     30   %1 = getelementptr inbounds i32, i32* %a, i64 1024
     31   ret i32* %1
     32 }
     33 
     34 define i32* @test_array4(i32* %a) {
     35 ; CHECK-LABEL: test_array4
     36 ; CHECK:       mov [[REG:x[0-9]+]], #4104
     37 ; CHECK-NEXR:  add x0, x0, [[REG]]
     38   %1 = getelementptr inbounds i32, i32* %a, i64 1026
     39   ret i32* %1
     40 }
     41 
     42 define i32* @test_array5(i32* %a, i32 %i) {
     43 ; CHECK-LABEL: test_array5
     44 ; CHECK:       sxtw [[REG1:x[0-9]+]], w1
     45 ; CHECK-NEXT:  orr  [[REG2:x[0-9]+]], xzr, #0x4
     46 ; CHECK-NEXT:  madd  {{x[0-9]+}}, [[REG1]], [[REG2]], x0
     47   %1 = getelementptr inbounds i32, i32* %a, i32 %i
     48   ret i32* %1
     49 }
     50