Home | History | Annotate | Download | only in AArch64
      1 ; RUN: opt < %s -mtriple=aarch64 -interleaved-access -S | FileCheck %s
      2 
      3 ; CHECK-LABEL: @extract_user_basic(
      4 ; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
      5 ; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0
      6 ; CHECK: extractelement <4 x i32> %[[R]], i64 1
      7 define void @extract_user_basic(<8 x i32>* %A, i1 %C) {
      8 entry:
      9   %L = load <8 x i32>, <8 x i32>* %A, align 8
     10   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     11   br i1 %C, label %if.then, label %if.merge
     12 
     13 if.then:
     14   %E = extractelement <8 x i32> %L, i32 2
     15   br label %if.merge
     16 
     17 if.merge:
     18   ret void
     19 }
     20 
     21 ; CHECK-LABEL: @extract_user_multi(
     22 ; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
     23 ; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0
     24 ; CHECK: extractelement <4 x i32> %[[R]], i64 0
     25 ; CHECK: extractelement <4 x i32> %[[R]], i64 1
     26 define void @extract_user_multi(<8 x i32>* %A, i1 %C) {
     27 entry:
     28   %L = load <8 x i32>, <8 x i32>* %A, align 8
     29   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     30   br i1 %C, label %if.then, label %if.merge
     31 
     32 if.then:
     33   %E1 = extractelement <8 x i32> %L, i32 0
     34   br label %if.merge
     35 
     36 if.merge:
     37   %E2 = extractelement <8 x i32> %L, i32 2
     38   ret void
     39 }
     40 
     41 ; CHECK-LABEL: @extract_user_multi_no_dom(
     42 ; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
     43 define void @extract_user_multi_no_dom(<8 x i32>* %A, i1 %C) {
     44 entry:
     45   %L = load <8 x i32>, <8 x i32>* %A, align 8
     46   %E1 = extractelement <8 x i32> %L, i32 0
     47   br i1 %C, label %if.then, label %if.merge
     48 
     49 if.then:
     50   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     51   %E2 = extractelement <8 x i32> %L, i32 2
     52   br label %if.merge
     53 
     54 if.merge:
     55   ret void
     56 }
     57 
     58 ; CHECK-LABEL: @extract_user_wrong_const_index(
     59 ; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
     60 define void @extract_user_wrong_const_index(<8 x i32>* %A) {
     61 entry:
     62   %L = load <8 x i32>, <8 x i32>* %A, align 8
     63   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     64   %E = extractelement <8 x i32> %L, i32 1
     65   ret void
     66 }
     67 
     68 ; CHECK-LABEL: @extract_user_undef_index(
     69 ; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
     70 define void @extract_user_undef_index(<8 x i32>* %A) {
     71 entry:
     72   %L = load <8 x i32>, <8 x i32>* %A, align 8
     73   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     74   %E = extractelement <8 x i32> %L, i32 undef
     75   ret void
     76 }
     77 
     78 ; CHECK-LABEL: @extract_user_var_index(
     79 ; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
     80 define void @extract_user_var_index(<8 x i32>* %A, i32 %I) {
     81 entry:
     82   %L = load <8 x i32>, <8 x i32>* %A, align 8
     83   %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     84   %E = extractelement <8 x i32> %L, i32 %I
     85   ret void
     86 }
     87