Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i686-linux -mcpu=corei7-avx | FileCheck %s
      2 ; RUN: opt -instsimplify -disable-output < %s
      3 
      4 ;CHECK-LABEL: AGEP0:
      5 define <4 x i32*> @AGEP0(i32* %ptr) nounwind {
      6 entry:
      7 ;CHECK-LABEL: AGEP0
      8 ;CHECK: vbroadcast
      9 ;CHECK-NEXT: vpaddd
     10 ;CHECK-NEXT: ret
     11   %vecinit.i = insertelement <4 x i32*> undef, i32* %ptr, i32 0
     12   %vecinit2.i = insertelement <4 x i32*> %vecinit.i, i32* %ptr, i32 1
     13   %vecinit4.i = insertelement <4 x i32*> %vecinit2.i, i32* %ptr, i32 2
     14   %vecinit6.i = insertelement <4 x i32*> %vecinit4.i, i32* %ptr, i32 3
     15   %A2 = getelementptr i32, <4 x i32*> %vecinit6.i, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
     16   %A3 = getelementptr i32, <4 x i32*> %A2, <4 x i32> <i32 10, i32 14, i32 19, i32 233>
     17   ret <4 x i32*> %A3
     18 }
     19 
     20 ;CHECK-LABEL: AGEP1:
     21 define i32 @AGEP1(<4 x i32*> %param) nounwind {
     22 entry:
     23 ;CHECK-LABEL: AGEP1
     24 ;CHECK: vpaddd
     25 ;CHECK-NEXT: vpextrd
     26 ;CHECK-NEXT: movl
     27   %A2 = getelementptr i32, <4 x i32*> %param, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
     28   %k = extractelement <4 x i32*> %A2, i32 3
     29   %v = load i32, i32* %k
     30   ret i32 %v
     31 ;CHECK: ret
     32 }
     33 
     34 ;CHECK-LABEL: AGEP2:
     35 define i32 @AGEP2(<4 x i32*> %param, <4 x i32> %off) nounwind {
     36 entry:
     37 ;CHECK-LABEL: AGEP2
     38 ;CHECK: vpslld $2
     39 ;CHECK-NEXT: vpadd
     40   %A2 = getelementptr i32, <4 x i32*> %param, <4 x i32> %off
     41   %k = extractelement <4 x i32*> %A2, i32 3
     42   %v = load i32, i32* %k
     43   ret i32 %v
     44 ;CHECK: ret
     45 }
     46 
     47 ;CHECK-LABEL: AGEP3:
     48 define <4 x i32*> @AGEP3(<4 x i32*> %param, <4 x i32> %off) nounwind {
     49 entry:
     50 ;CHECK-LABEL: AGEP3
     51 ;CHECK: vpslld $2
     52 ;CHECK-NEXT: vpadd
     53   %A2 = getelementptr i32, <4 x i32*> %param, <4 x i32> %off
     54   %v = alloca i32
     55   %k = insertelement <4 x i32*> %A2, i32* %v, i32 3
     56   ret <4 x i32*> %k
     57 ;CHECK: ret
     58 }
     59 
     60 ;CHECK-LABEL: AGEP4:
     61 define <4 x i16*> @AGEP4(<4 x i16*> %param, <4 x i32> %off) nounwind {
     62 entry:
     63 ;CHECK-LABEL: AGEP4
     64 ; Multiply offset by two (add it to itself).
     65 ;CHECK: vpadd
     66 ; add the base to the offset
     67 ;CHECK-NEXT: vpadd
     68   %A = getelementptr i16, <4 x i16*> %param, <4 x i32> %off
     69   ret <4 x i16*> %A
     70 ;CHECK: ret
     71 }
     72 
     73 ;CHECK-LABEL: AGEP5:
     74 define <4 x i8*> @AGEP5(<4 x i8*> %param, <4 x i8> %off) nounwind {
     75 entry:
     76 ;CHECK-LABEL: AGEP5
     77 ;CHECK: vpaddd
     78   %A = getelementptr i8, <4 x i8*> %param, <4 x i8> %off
     79   ret <4 x i8*> %A
     80 ;CHECK: ret
     81 }
     82 
     83 
     84 ; The size of each element is 1 byte. No need to multiply by element size.
     85 ;CHECK-LABEL: AGEP6:
     86 define <4 x i8*> @AGEP6(<4 x i8*> %param, <4 x i32> %off) nounwind {
     87 entry:
     88 ;CHECK-LABEL: AGEP6
     89 ;CHECK-NOT: pslld
     90   %A = getelementptr i8, <4 x i8*> %param, <4 x i32> %off
     91   ret <4 x i8*> %A
     92 ;CHECK: ret
     93 }
     94 
     95