2012-12-11 07:21:26 +08:00
|
|
|
; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -pre-RA-sched=source -disable-post-ra | FileCheck %s
|
2015-07-29 06:44:28 +08:00
|
|
|
; RUN: llc < %s -mtriple=thumbv6m-apple-ios -mcpu=cortex-m0 -pre-RA-sched=source -disable-post-ra -mattr=+strict-align | FileCheck %s -check-prefix=CHECK-T1
|
2011-04-01 06:14:03 +08:00
|
|
|
%struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
|
2011-06-18 14:05:24 +08:00
|
|
|
|
2007-10-23 06:11:27 +08:00
|
|
|
@src = external global %struct.x
|
|
|
|
@dst = external global %struct.x
|
|
|
|
|
2012-12-11 07:21:26 +08:00
|
|
|
@.str1 = private unnamed_addr constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 1
|
|
|
|
@.str2 = private unnamed_addr constant [36 x i8] c"DHRYSTONE PROGRAM, SOME STRING BLAH\00", align 1
|
|
|
|
@.str3 = private unnamed_addr constant [24 x i8] c"DHRYSTONE PROGRAM, SOME\00", align 1
|
|
|
|
@.str4 = private unnamed_addr constant [18 x i8] c"DHRYSTONE PROGR \00", align 1
|
|
|
|
@.str5 = private unnamed_addr constant [7 x i8] c"DHRYST\00", align 1
|
|
|
|
@.str6 = private unnamed_addr constant [14 x i8] c"/tmp/rmXXXXXX\00", align 1
|
|
|
|
@spool.splbuf = internal global [512 x i8] zeroinitializer, align 16
|
|
|
|
|
|
|
|
define i32 @t0() {
|
2007-10-23 06:11:27 +08:00
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t0:
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vldr [[REG1:d[0-9]+]],
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK: vstr [[REG1]],
|
|
|
|
; CHECK-T1-LABEL: t0:
|
|
|
|
; CHECK-T1: ldrb [[TREG1:r[0-9]]],
|
|
|
|
; CHECK-T1: strb [[TREG1]],
|
|
|
|
; CHECK-T1: ldrh [[TREG2:r[0-9]]],
|
|
|
|
; CHECK-T1: strh [[TREG2]]
|
2015-11-19 13:56:52 +08:00
|
|
|
call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds (%struct.x, %struct.x* @dst, i32 0, i32 0), i8* getelementptr inbounds (%struct.x, %struct.x* @src, i32 0, i32 0), i32 11, i32 8, i1 false)
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i32 0
|
2007-10-23 06:11:27 +08:00
|
|
|
}
|
|
|
|
|
2012-12-11 07:21:26 +08:00
|
|
|
define void @t1(i8* nocapture %C) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t1:
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vld1.64 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]
|
|
|
|
; CHECK: adds r0, #15
|
|
|
|
; CHECK: adds r1, #15
|
|
|
|
; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]
|
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str1, i64 0, i64 0), i64 31, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t2(i8* nocapture %C) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t2:
|
2014-01-25 10:02:55 +08:00
|
|
|
; CHECK: movw [[REG2:r[0-9]+]], #16716
|
|
|
|
; CHECK: movt [[REG2:r[0-9]+]], #72
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: str [[REG2]], [r0, #32]
|
[ARM] Re-re-apply VLD1/VST1 base-update combine.
This re-applies r223862, r224198, r224203, and r224754, which were
reverted in r228129 because they exposed Clang misalignment problems
when self-hosting.
The combine caused the crashes because we turned ISD::LOAD/STORE nodes
to ARMISD::VLD1/VST1_UPD nodes. When selecting addressing modes, we
were very lax for the former, and only emitted the alignment operand
(as in "[r1:128]") when it was larger than the standard alignment of
the memory type.
However, for ARMISD nodes, we just used the MMO alignment, no matter
what. In our case, we turned ISD nodes to ARMISD nodes, and this
caused the alignment operands to start being emitted.
And that's how we exposed alignment problems that were ignored before
(but I believe would have been caught with SCTRL.A==1?).
To fix this, we can just mirror the hack done for ISD nodes: only
take into account the MMO alignment when the access is overaligned.
Original commit message:
We used to only combine intrinsics, and turn them into VLD1_UPD/VST1_UPD
when the base pointer is incremented after the load/store.
We can do the same thing for generic load/stores.
Note that we can only combine the first load/store+adds pair in
a sequence (as might be generated for a v16f32 load for instance),
because other combines turn the base pointer addition chain (each
computing the address of the next load, from the address of the last
load) into independent additions (common base pointer + this load's
offset).
rdar://19717869, rdar://14062261.
llvm-svn: 229932
2015-02-20 07:52:41 +08:00
|
|
|
; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]!
|
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]!
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vld1.64 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str2, i64 0, i64 0), i64 36, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t3(i8* nocapture %C) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t3:
|
[ARM] Re-re-apply VLD1/VST1 base-update combine.
This re-applies r223862, r224198, r224203, and r224754, which were
reverted in r228129 because they exposed Clang misalignment problems
when self-hosting.
The combine caused the crashes because we turned ISD::LOAD/STORE nodes
to ARMISD::VLD1/VST1_UPD nodes. When selecting addressing modes, we
were very lax for the former, and only emitted the alignment operand
(as in "[r1:128]") when it was larger than the standard alignment of
the memory type.
However, for ARMISD nodes, we just used the MMO alignment, no matter
what. In our case, we turned ISD nodes to ARMISD nodes, and this
caused the alignment operands to start being emitted.
And that's how we exposed alignment problems that were ignored before
(but I believe would have been caught with SCTRL.A==1?).
To fix this, we can just mirror the hack done for ISD nodes: only
take into account the MMO alignment when the access is overaligned.
Original commit message:
We used to only combine intrinsics, and turn them into VLD1_UPD/VST1_UPD
when the base pointer is incremented after the load/store.
We can do the same thing for generic load/stores.
Note that we can only combine the first load/store+adds pair in
a sequence (as might be generated for a v16f32 load for instance),
because other combines turn the base pointer addition chain (each
computing the address of the next load, from the address of the last
load) into independent additions (common base pointer + this load's
offset).
rdar://19717869, rdar://14062261.
llvm-svn: 229932
2015-02-20 07:52:41 +08:00
|
|
|
; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]!
|
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]!
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vldr d{{[0-9]+}}, [r1]
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vst1.8 {d{{[0-9]+}}}, [r0]
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str3, i64 0, i64 0), i64 24, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t4(i8* nocapture %C) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t4:
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vld1.64 {[[REG3:d[0-9]+]], [[REG4:d[0-9]+]]}, [r1]
|
[ARM] Re-re-apply VLD1/VST1 base-update combine.
This re-applies r223862, r224198, r224203, and r224754, which were
reverted in r228129 because they exposed Clang misalignment problems
when self-hosting.
The combine caused the crashes because we turned ISD::LOAD/STORE nodes
to ARMISD::VLD1/VST1_UPD nodes. When selecting addressing modes, we
were very lax for the former, and only emitted the alignment operand
(as in "[r1:128]") when it was larger than the standard alignment of
the memory type.
However, for ARMISD nodes, we just used the MMO alignment, no matter
what. In our case, we turned ISD nodes to ARMISD nodes, and this
caused the alignment operands to start being emitted.
And that's how we exposed alignment problems that were ignored before
(but I believe would have been caught with SCTRL.A==1?).
To fix this, we can just mirror the hack done for ISD nodes: only
take into account the MMO alignment when the access is overaligned.
Original commit message:
We used to only combine intrinsics, and turn them into VLD1_UPD/VST1_UPD
when the base pointer is incremented after the load/store.
We can do the same thing for generic load/stores.
Note that we can only combine the first load/store+adds pair in
a sequence (as might be generated for a v16f32 load for instance),
because other combines turn the base pointer addition chain (each
computing the address of the next load, from the address of the last
load) into independent additions (common base pointer + this load's
offset).
rdar://19717869, rdar://14062261.
llvm-svn: 229932
2015-02-20 07:52:41 +08:00
|
|
|
; CHECK: vst1.8 {[[REG3]], [[REG4]]}, [r0]!
|
|
|
|
; CHECK: strh [[REG5:r[0-9]+]], [r0]
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str4, i64 0, i64 0), i64 18, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t5(i8* nocapture %C) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t5:
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: movs [[REG5:r[0-9]+]], #0
|
|
|
|
; CHECK: strb [[REG5]], [r0, #6]
|
|
|
|
; CHECK: movw [[REG6:r[0-9]+]], #21587
|
|
|
|
; CHECK: strh [[REG6]], [r0, #4]
|
2014-01-25 10:02:55 +08:00
|
|
|
; CHECK: movw [[REG7:r[0-9]+]], #18500
|
|
|
|
; CHECK: movt [[REG7:r[0-9]+]], #22866
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: str [[REG7]]
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK-T1-LABEL: t5:
|
|
|
|
; CHECK-T1: movs [[TREG3:r[0-9]]],
|
|
|
|
; CHECK-T1: strb [[TREG3]],
|
|
|
|
; CHECK-T1: movs [[TREG4:r[0-9]]],
|
|
|
|
; CHECK-T1: strb [[TREG4]],
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str5, i64 0, i64 0), i64 7, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t6() nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t6:
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vldr [[REG9:d[0-9]+]], [r0]
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK: vstr [[REG9]], [r1]
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: adds r1, #6
|
|
|
|
; CHECK: adds r0, #6
|
2015-04-13 18:47:39 +08:00
|
|
|
; CHECK: vld1.16
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vst1.16
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK-T1-LABEL: t6:
|
|
|
|
; CHECK-T1: movs [[TREG5:r[0-9]]],
|
|
|
|
; CHECK-T1: strh [[TREG5]],
|
|
|
|
; CHECK-T1: ldr [[TREG6:r[0-9]]],
|
|
|
|
; CHECK-T1: str [[TREG6]]
|
2015-11-19 13:56:52 +08:00
|
|
|
call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @spool.splbuf, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str6, i64 0, i64 0), i64 14, i32 1, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
%struct.Foo = type { i32, i32, i32, i32 }
|
|
|
|
|
|
|
|
define void @t7(%struct.Foo* nocapture %a, %struct.Foo* nocapture %b) nounwind {
|
|
|
|
entry:
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK-LABEL: t7:
|
2012-12-11 07:21:26 +08:00
|
|
|
; CHECK: vld1.32
|
|
|
|
; CHECK: vst1.32
|
2014-05-16 22:24:22 +08:00
|
|
|
; CHECK-T1-LABEL: t7:
|
|
|
|
; CHECK-T1: ldr
|
|
|
|
; CHECK-T1: str
|
2012-12-11 07:21:26 +08:00
|
|
|
%0 = bitcast %struct.Foo* %a to i8*
|
|
|
|
%1 = bitcast %struct.Foo* %b to i8*
|
2015-11-19 13:56:52 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 16, i32 4, i1 false)
|
2012-12-11 07:21:26 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-11-19 13:56:52 +08:00
|
|
|
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
|
|
|
|
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|