mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
88c04dfc81
The justification of this change is here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/082989.html According to the current GEP syntax, vector GEP requires that each index must be a vector with the same number of elements. %A = getelementptr i8, <4 x i8*> %ptrs, <4 x i64> %offsets In this implementation I let each index be or vector or scalar. All vector indices must have the same number of elements. The scalar value will mean the splat vector value. (1) %A = getelementptr i8, i8* %ptr, <4 x i64> %offsets or (2) %A = getelementptr i8, <4 x i8*> %ptrs, i64 %offset In all cases the %A type is <4 x i8*> In the case (2) we add the same offset to all pointers. The case (1) covers C[B[i]] case, when we have the same base C and different offsets B[i]. The documentation is updated. http://reviews.llvm.org/D10496 llvm-svn: 241788
25 lines
696 B
LLVM
25 lines
696 B
LLVM
; RUN: not llvm-as < %s >/dev/null 2> %t
|
|
; RUN: FileCheck %s < %t
|
|
; Test that a vector pointer may be used with a scalar index.
|
|
; Test that a vector pointer and vector index should have the same vector width
|
|
|
|
; This code is correct
|
|
define <2 x i32*> @test2(<2 x i32*> %a) {
|
|
%w = getelementptr i32, <2 x i32*> %a, i32 2
|
|
ret <2 x i32*> %w
|
|
}
|
|
|
|
; This code is correct
|
|
define <2 x i32*> @test3(i32* %a) {
|
|
%w = getelementptr i32, i32* %a, <2 x i32> <i32 2, i32 2>
|
|
ret <2 x i32*> %w
|
|
}
|
|
|
|
; CHECK: getelementptr vector index has a wrong number of elements
|
|
|
|
define <2 x i32> @test1(<2 x i32*> %a) {
|
|
%w = getelementptr i32, <2 x i32*> %a, <4 x i32><i32 2, i32 2, i32 2, i32 2>
|
|
ret <2 x i32> %w
|
|
}
|
|
|