2016-07-19 21:35:11 +08:00
|
|
|
; RUN: llc < %s -mtriple=arm64-eabi -aarch64-redzone | FileCheck %s
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @store64(i64* %ptr, i64 %index, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: store64:
|
|
|
|
; CHECK: str x{{[0-9+]}}, [x{{[0-9+]}}], #8
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 1
|
|
|
|
store i64 %spacing, i64* %ptr, align 4
|
|
|
|
ret i64* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @store64idxpos256(i64* %ptr, i64 %index, i64 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store64idxpos256:
|
|
|
|
; CHECK: add x{{[0-9+]}}, x{{[0-9+]}}, #256
|
|
|
|
; CHECK: str x{{[0-9+]}}, [x{{[0-9+]}}]
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 32
|
|
|
|
store i64 %spacing, i64* %ptr, align 4
|
|
|
|
ret i64* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @store64idxneg256(i64* %ptr, i64 %index, i64 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store64idxneg256:
|
|
|
|
; CHECK: str x{{[0-9+]}}, [x{{[0-9+]}}], #-256
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 -32
|
|
|
|
store i64 %spacing, i64* %ptr, align 4
|
|
|
|
ret i64* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @store32(i32* %ptr, i32 %index, i32 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: store32:
|
|
|
|
; CHECK: str w{{[0-9+]}}, [x{{[0-9+]}}], #4
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 1
|
|
|
|
store i32 %spacing, i32* %ptr, align 4
|
|
|
|
ret i32* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @store32idxpos256(i32* %ptr, i32 %index, i32 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store32idxpos256:
|
|
|
|
; CHECK: add x{{[0-9+]}}, x{{[0-9+]}}, #256
|
|
|
|
; CHECK: str w{{[0-9+]}}, [x{{[0-9+]}}]
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 64
|
|
|
|
store i32 %spacing, i32* %ptr, align 4
|
|
|
|
ret i32* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @store32idxneg256(i32* %ptr, i32 %index, i32 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store32idxneg256:
|
|
|
|
; CHECK: str w{{[0-9+]}}, [x{{[0-9+]}}], #-256
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 -64
|
|
|
|
store i32 %spacing, i32* %ptr, align 4
|
|
|
|
ret i32* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @store16(i16* %ptr, i16 %index, i16 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: store16:
|
|
|
|
; CHECK: strh w{{[0-9+]}}, [x{{[0-9+]}}], #2
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 1
|
|
|
|
store i16 %spacing, i16* %ptr, align 4
|
|
|
|
ret i16* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @store16idxpos256(i16* %ptr, i16 %index, i16 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store16idxpos256:
|
|
|
|
; CHECK: add x{{[0-9+]}}, x{{[0-9+]}}, #256
|
|
|
|
; CHECK: strh w{{[0-9+]}}, [x{{[0-9+]}}]
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 128
|
|
|
|
store i16 %spacing, i16* %ptr, align 4
|
|
|
|
ret i16* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @store16idxneg256(i16* %ptr, i16 %index, i16 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store16idxneg256:
|
|
|
|
; CHECK: strh w{{[0-9+]}}, [x{{[0-9+]}}], #-256
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 -128
|
|
|
|
store i16 %spacing, i16* %ptr, align 4
|
|
|
|
ret i16* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @store8(i8* %ptr, i8 %index, i8 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: store8:
|
|
|
|
; CHECK: strb w{{[0-9+]}}, [x{{[0-9+]}}], #1
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 1
|
|
|
|
store i8 %spacing, i8* %ptr, align 4
|
|
|
|
ret i8* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @store8idxpos256(i8* %ptr, i8 %index, i8 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store8idxpos256:
|
|
|
|
; CHECK: add x{{[0-9+]}}, x{{[0-9+]}}, #256
|
|
|
|
; CHECK: strb w{{[0-9+]}}, [x{{[0-9+]}}]
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 256
|
|
|
|
store i8 %spacing, i8* %ptr, align 4
|
|
|
|
ret i8* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @store8idxneg256(i8* %ptr, i8 %index, i8 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: store8idxneg256:
|
|
|
|
; CHECK: strb w{{[0-9+]}}, [x{{[0-9+]}}], #-256
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 -256
|
|
|
|
store i8 %spacing, i8* %ptr, align 4
|
|
|
|
ret i8* %incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @truncst64to32(i32* %ptr, i32 %index, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: truncst64to32:
|
|
|
|
; CHECK: str w{{[0-9+]}}, [x{{[0-9+]}}], #4
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 1
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i32
|
2016-12-23 06:27:05 +08:00
|
|
|
store i32 %trunc, i32* %ptr, align 4
|
|
|
|
ret i32* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @truncst64to16(i16* %ptr, i16 %index, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: truncst64to16:
|
|
|
|
; CHECK: strh w{{[0-9+]}}, [x{{[0-9+]}}], #2
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 1
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i16
|
2016-12-23 06:27:05 +08:00
|
|
|
store i16 %trunc, i16* %ptr, align 4
|
|
|
|
ret i16* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @truncst64to8(i8* %ptr, i8 %index, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: truncst64to8:
|
|
|
|
; CHECK: strb w{{[0-9+]}}, [x{{[0-9+]}}], #1
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 1
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i8
|
2016-12-23 06:27:05 +08:00
|
|
|
store i8 %trunc, i8* %ptr, align 4
|
|
|
|
ret i8* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define half* @storef16(half* %ptr, half %index, half %spacing) nounwind {
|
2015-08-04 09:29:38 +08:00
|
|
|
; CHECK-LABEL: storef16:
|
|
|
|
; CHECK: str h{{[0-9+]}}, [x{{[0-9+]}}], #2
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds half, half* %ptr, i64 1
|
|
|
|
store half %spacing, half* %ptr, align 2
|
|
|
|
ret half* %incdec.ptr
|
2015-08-04 09:29:38 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define float* @storef32(float* %ptr, float %index, float %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: storef32:
|
|
|
|
; CHECK: str s{{[0-9+]}}, [x{{[0-9+]}}], #4
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds float, float* %ptr, i64 1
|
|
|
|
store float %spacing, float* %ptr, align 4
|
|
|
|
ret float* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define double* @storef64(double* %ptr, double %index, double %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: storef64:
|
|
|
|
; CHECK: str d{{[0-9+]}}, [x{{[0-9+]}}], #8
|
|
|
|
; CHECK: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds double, double* %ptr, i64 1
|
|
|
|
store double %spacing, double* %ptr, align 4
|
|
|
|
ret double* %incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
|
|
|
|
define double* @pref64(double* %ptr, double %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pref64:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str d0, [x0, #32]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds double, double* %ptr, i64 4
|
|
|
|
store double %spacing, double* %incdec.ptr, align 4
|
|
|
|
ret double *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define float* @pref32(float* %ptr, float %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pref32:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str s0, [x0, #12]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds float, float* %ptr, i64 3
|
|
|
|
store float %spacing, float* %incdec.ptr, align 4
|
|
|
|
ret float *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define half* @pref16(half* %ptr, half %spacing) nounwind {
|
2015-08-04 09:29:38 +08:00
|
|
|
; CHECK-LABEL: pref16:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str h0, [x0, #6]!
|
2015-08-04 09:29:38 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds half, half* %ptr, i64 3
|
|
|
|
store half %spacing, half* %incdec.ptr, align 2
|
|
|
|
ret half *%incdec.ptr
|
2015-08-04 09:29:38 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @pre64(i64* %ptr, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pre64:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str x1, [x0, #16]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 2
|
|
|
|
store i64 %spacing, i64* %incdec.ptr, align 4
|
|
|
|
ret i64 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @pre64idxpos256(i64* %ptr, i64 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre64idxpos256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: add x8, x0, #256
|
|
|
|
; CHECK-NEXT: str x1, [x0, #256]
|
|
|
|
; CHECK-NEXT: mov x0, x8
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 32
|
|
|
|
store i64 %spacing, i64* %incdec.ptr, align 4
|
|
|
|
ret i64 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i64* @pre64idxneg256(i64* %ptr, i64 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre64idxneg256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str x1, [x0, #-256]!
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %ptr, i64 -32
|
|
|
|
store i64 %spacing, i64* %incdec.ptr, align 4
|
|
|
|
ret i64 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @pre32(i32* %ptr, i32 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pre32:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str w1, [x0, #8]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 2
|
|
|
|
store i32 %spacing, i32* %incdec.ptr, align 4
|
|
|
|
ret i32 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @pre32idxpos256(i32* %ptr, i32 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre32idxpos256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: add x8, x0, #256
|
|
|
|
; CHECK-NEXT: str w1, [x0, #256]
|
|
|
|
; CHECK-NEXT: mov x0, x8
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 64
|
|
|
|
store i32 %spacing, i32* %incdec.ptr, align 4
|
|
|
|
ret i32 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @pre32idxneg256(i32* %ptr, i32 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre32idxneg256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str w1, [x0, #-256]!
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 -64
|
|
|
|
store i32 %spacing, i32* %incdec.ptr, align 4
|
|
|
|
ret i32 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @pre16(i16* %ptr, i16 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pre16:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strh w1, [x0, #4]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 2
|
|
|
|
store i16 %spacing, i16* %incdec.ptr, align 4
|
|
|
|
ret i16 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @pre16idxpos256(i16* %ptr, i16 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre16idxpos256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: add x8, x0, #256
|
|
|
|
; CHECK-NEXT: strh w1, [x0, #256]
|
|
|
|
; CHECK-NEXT: mov x0, x8
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 128
|
|
|
|
store i16 %spacing, i16* %incdec.ptr, align 4
|
|
|
|
ret i16 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @pre16idxneg256(i16* %ptr, i16 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre16idxneg256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strh w1, [x0, #-256]!
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 -128
|
|
|
|
store i16 %spacing, i16* %incdec.ptr, align 4
|
|
|
|
ret i16 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @pre8(i8* %ptr, i8 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pre8:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strb w1, [x0, #2]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 2
|
|
|
|
store i8 %spacing, i8* %incdec.ptr, align 4
|
|
|
|
ret i8 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @pre8idxpos256(i8* %ptr, i8 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre8idxpos256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: add x8, x0, #256
|
|
|
|
; CHECK-NEXT: strb w1, [x0, #256]
|
|
|
|
; CHECK-NEXT: mov x0, x8
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 256
|
|
|
|
store i8 %spacing, i8* %incdec.ptr, align 4
|
|
|
|
ret i8 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @pre8idxneg256(i8* %ptr, i8 %spacing) {
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-LABEL: pre8idxneg256:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strb w1, [x0, #-256]!
|
2016-12-22 09:39:24 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 -256
|
|
|
|
store i8 %spacing, i8* %incdec.ptr, align 4
|
|
|
|
ret i8 *%incdec.ptr
|
2016-12-22 09:39:24 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i32* @pretrunc64to32(i32* %ptr, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pretrunc64to32:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: str w1, [x0, #8]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i32, i32* %ptr, i64 2
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i32
|
2016-12-23 06:27:05 +08:00
|
|
|
store i32 %trunc, i32* %incdec.ptr, align 4
|
|
|
|
ret i32 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i16* @pretrunc64to16(i16* %ptr, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pretrunc64to16:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strh w1, [x0, #4]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i16, i16* %ptr, i64 2
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i16
|
2016-12-23 06:27:05 +08:00
|
|
|
store i16 %trunc, i16* %incdec.ptr, align 4
|
|
|
|
ret i16 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
2016-12-23 06:27:05 +08:00
|
|
|
define i8* @pretrunc64to8(i8* %ptr, i64 %spacing) {
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-LABEL: pretrunc64to8:
|
2016-12-23 06:27:05 +08:00
|
|
|
; CHECK: strb w1, [x0, #2]!
|
2014-03-29 18:18:08 +08:00
|
|
|
; CHECK-NEXT: ret
|
2016-12-23 06:27:05 +08:00
|
|
|
%incdec.ptr = getelementptr inbounds i8, i8* %ptr, i64 2
|
2014-03-29 18:18:08 +08:00
|
|
|
%trunc = trunc i64 %spacing to i8
|
2016-12-23 06:27:05 +08:00
|
|
|
store i8 %trunc, i8* %incdec.ptr, align 4
|
|
|
|
ret i8 *%incdec.ptr
|
2014-03-29 18:18:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
;-----
|
|
|
|
; Pre-indexed loads
|
|
|
|
;-----
|
|
|
|
define double* @preidxf64(double* %src, double* %out) {
|
|
|
|
; CHECK-LABEL: preidxf64:
|
|
|
|
; CHECK: ldr d0, [x0, #8]!
|
|
|
|
; CHECK: str d0, [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds double, double* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load double, double* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
store double %tmp, double* %out, align 4
|
|
|
|
ret double* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define float* @preidxf32(float* %src, float* %out) {
|
|
|
|
; CHECK-LABEL: preidxf32:
|
|
|
|
; CHECK: ldr s0, [x0, #4]!
|
|
|
|
; CHECK: str s0, [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds float, float* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load float, float* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
store float %tmp, float* %out, align 4
|
|
|
|
ret float* %ptr
|
|
|
|
}
|
|
|
|
|
2015-08-04 09:29:38 +08:00
|
|
|
define half* @preidxf16(half* %src, half* %out) {
|
|
|
|
; CHECK-LABEL: preidxf16:
|
|
|
|
; CHECK: ldr h0, [x0, #2]!
|
|
|
|
; CHECK: str h0, [x1]
|
|
|
|
; CHECK: ret
|
|
|
|
%ptr = getelementptr inbounds half, half* %src, i64 1
|
|
|
|
%tmp = load half, half* %ptr, align 2
|
|
|
|
store half %tmp, half* %out, align 2
|
|
|
|
ret half* %ptr
|
|
|
|
}
|
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
define i64* @preidx64(i64* %src, i64* %out) {
|
|
|
|
; CHECK-LABEL: preidx64:
|
|
|
|
; CHECK: ldr x[[REG:[0-9]+]], [x0, #8]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i64, i64* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i64, i64* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
store i64 %tmp, i64* %out, align 4
|
|
|
|
ret i64* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @preidx32(i32* %src, i32* %out) {
|
|
|
|
; CHECK: ldr w[[REG:[0-9]+]], [x0, #4]!
|
|
|
|
; CHECK: str w[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i32, i32* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
store i32 %tmp, i32* %out, align 4
|
|
|
|
ret i32* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16* @preidx16zext32(i16* %src, i32* %out) {
|
|
|
|
; CHECK: ldrh w[[REG:[0-9]+]], [x0, #2]!
|
|
|
|
; CHECK: str w[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i16, i16* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i16, i16* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = zext i16 %tmp to i32
|
|
|
|
store i32 %ext, i32* %out, align 4
|
|
|
|
ret i16* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16* @preidx16zext64(i16* %src, i64* %out) {
|
|
|
|
; CHECK: ldrh w[[REG:[0-9]+]], [x0, #2]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i16, i16* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i16, i16* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = zext i16 %tmp to i64
|
|
|
|
store i64 %ext, i64* %out, align 4
|
|
|
|
ret i16* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @preidx8zext32(i8* %src, i32* %out) {
|
|
|
|
; CHECK: ldrb w[[REG:[0-9]+]], [x0, #1]!
|
|
|
|
; CHECK: str w[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i8, i8* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i8, i8* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = zext i8 %tmp to i32
|
|
|
|
store i32 %ext, i32* %out, align 4
|
|
|
|
ret i8* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @preidx8zext64(i8* %src, i64* %out) {
|
|
|
|
; CHECK: ldrb w[[REG:[0-9]+]], [x0, #1]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i8, i8* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i8, i8* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = zext i8 %tmp to i64
|
|
|
|
store i64 %ext, i64* %out, align 4
|
|
|
|
ret i8* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @preidx32sext64(i32* %src, i64* %out) {
|
|
|
|
; CHECK: ldrsw x[[REG:[0-9]+]], [x0, #4]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i32, i32* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = sext i32 %tmp to i64
|
|
|
|
store i64 %ext, i64* %out, align 8
|
|
|
|
ret i32* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16* @preidx16sext32(i16* %src, i32* %out) {
|
|
|
|
; CHECK: ldrsh w[[REG:[0-9]+]], [x0, #2]!
|
|
|
|
; CHECK: str w[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i16, i16* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i16, i16* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = sext i16 %tmp to i32
|
|
|
|
store i32 %ext, i32* %out, align 4
|
|
|
|
ret i16* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16* @preidx16sext64(i16* %src, i64* %out) {
|
|
|
|
; CHECK: ldrsh x[[REG:[0-9]+]], [x0, #2]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i16, i16* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i16, i16* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = sext i16 %tmp to i64
|
|
|
|
store i64 %ext, i64* %out, align 4
|
|
|
|
ret i16* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @preidx8sext32(i8* %src, i32* %out) {
|
|
|
|
; CHECK: ldrsb w[[REG:[0-9]+]], [x0, #1]!
|
|
|
|
; CHECK: str w[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i8, i8* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i8, i8* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = sext i8 %tmp to i32
|
|
|
|
store i32 %ext, i32* %out, align 4
|
|
|
|
ret i8* %ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @preidx8sext64(i8* %src, i64* %out) {
|
|
|
|
; CHECK: ldrsb x[[REG:[0-9]+]], [x0, #1]!
|
|
|
|
; CHECK: str x[[REG]], [x1]
|
|
|
|
; CHECK: ret
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%ptr = getelementptr inbounds i8, i8* %src, i64 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i8, i8* %ptr, align 4
|
2014-03-29 18:18:08 +08:00
|
|
|
%ext = sext i8 %tmp to i64
|
|
|
|
store i64 %ext, i64* %out, align 4
|
|
|
|
ret i8* %ptr
|
|
|
|
}
|
2014-08-12 05:39:53 +08:00
|
|
|
|
|
|
|
; This test checks if illegal post-index is generated
|
|
|
|
|
|
|
|
define i64* @postidx_clobber(i64* %addr) nounwind noinline ssp {
|
|
|
|
; CHECK-LABEL: postidx_clobber:
|
|
|
|
; CHECK-NOT: str x0, [x0], #8
|
|
|
|
; ret
|
|
|
|
%paddr = bitcast i64* %addr to i64**
|
|
|
|
store i64* %addr, i64** %paddr
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%newaddr = getelementptr i64, i64* %addr, i32 1
|
2014-08-12 05:39:53 +08:00
|
|
|
ret i64* %newaddr
|
|
|
|
}
|