Skip to content

Commit 3785234

Browse files
[NFC][AArch64] Specify datalayout explicitly for cast.ll and
arith-overflow.ll and update tests accordingly. - These two tests stands out when data layout is explicitly added in a sweep study (D132889) Differential Revision: https://reviews.llvm.org/D132856
1 parent ae5d542 commit 3785234

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

llvm/test/Analysis/CostModel/AArch64/arith-overflow.ll

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=aarch64 < %s | FileCheck %s --check-prefix=RECIP
33
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=aarch64 < %s | FileCheck %s --check-prefix=SIZE
44

5+
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6+
57
declare {i64, i1} @llvm.sadd.with.overflow.i64(i64, i64)
68
declare {<2 x i64>, <2 x i1>} @llvm.sadd.with.overflow.v2i64(<2 x i64>, <2 x i64>)
79
declare {<4 x i64>, <4 x i1>} @llvm.sadd.with.overflow.v4i64(<4 x i64>, <4 x i64>)
@@ -353,9 +355,9 @@ declare {<64 x i8>, <64 x i1>} @llvm.smul.with.overflow.v64i8(<64 x i8>, <64 x
353355
define i32 @smul(i32 %arg) {
354356
; RECIP-LABEL: 'smul'
355357
; RECIP-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I64 = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 undef, i64 undef)
356-
; RECIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %V2I64 = call { <2 x i64>, <2 x i1> } @llvm.smul.with.overflow.v2i64(<2 x i64> undef, <2 x i64> undef)
357-
; RECIP-NEXT: Cost Model: Found an estimated cost of 44 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.smul.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef)
358-
; RECIP-NEXT: Cost Model: Found an estimated cost of 88 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.smul.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef)
358+
; RECIP-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %V2I64 = call { <2 x i64>, <2 x i1> } @llvm.smul.with.overflow.v2i64(<2 x i64> undef, <2 x i64> undef)
359+
; RECIP-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.smul.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef)
360+
; RECIP-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.smul.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef)
359361
; RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %I32 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 undef, i32 undef)
360362
; RECIP-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %V4I32 = call { <4 x i32>, <4 x i1> } @llvm.smul.with.overflow.v4i32(<4 x i32> undef, <4 x i32> undef)
361363
; RECIP-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %V8I32 = call { <8 x i32>, <8 x i1> } @llvm.smul.with.overflow.v8i32(<8 x i32> undef, <8 x i32> undef)
@@ -365,9 +367,9 @@ define i32 @smul(i32 %arg) {
365367
; RECIP-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16I16 = call { <16 x i16>, <16 x i1> } @llvm.smul.with.overflow.v16i16(<16 x i16> undef, <16 x i16> undef)
366368
; RECIP-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32I16 = call { <32 x i16>, <32 x i1> } @llvm.smul.with.overflow.v32i16(<32 x i16> undef, <32 x i16> undef)
367369
; RECIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I8 = call { i8, i1 } @llvm.smul.with.overflow.i8(i8 undef, i8 undef)
368-
; RECIP-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V16I8 = call { <16 x i8>, <16 x i1> } @llvm.smul.with.overflow.v16i8(<16 x i8> undef, <16 x i8> undef)
369-
; RECIP-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V32I8 = call { <32 x i8>, <32 x i1> } @llvm.smul.with.overflow.v32i8(<32 x i8> undef, <32 x i8> undef)
370-
; RECIP-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V64I8 = call { <64 x i8>, <64 x i1> } @llvm.smul.with.overflow.v64i8(<64 x i8> undef, <64 x i8> undef)
370+
; RECIP-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V16I8 = call { <16 x i8>, <16 x i1> } @llvm.smul.with.overflow.v16i8(<16 x i8> undef, <16 x i8> undef)
371+
; RECIP-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V32I8 = call { <32 x i8>, <32 x i1> } @llvm.smul.with.overflow.v32i8(<32 x i8> undef, <32 x i8> undef)
372+
; RECIP-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V64I8 = call { <64 x i8>, <64 x i1> } @llvm.smul.with.overflow.v64i8(<64 x i8> undef, <64 x i8> undef)
371373
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
372374
;
373375
; SIZE-LABEL: 'smul'
@@ -435,9 +437,9 @@ declare {<64 x i8>, <64 x i1>} @llvm.umul.with.overflow.v64i8(<64 x i8>, <64 x
435437
define i32 @umul(i32 %arg) {
436438
; RECIP-LABEL: 'umul'
437439
; RECIP-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I64 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 undef, i64 undef)
438-
; RECIP-NEXT: Cost Model: Found an estimated cost of 21 for instruction: %V2I64 = call { <2 x i64>, <2 x i1> } @llvm.umul.with.overflow.v2i64(<2 x i64> undef, <2 x i64> undef)
439-
; RECIP-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.umul.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef)
440-
; RECIP-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.umul.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef)
440+
; RECIP-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %V2I64 = call { <2 x i64>, <2 x i1> } @llvm.umul.with.overflow.v2i64(<2 x i64> undef, <2 x i64> undef)
441+
; RECIP-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.umul.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef)
442+
; RECIP-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.umul.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef)
441443
; RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %I32 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 undef, i32 undef)
442444
; RECIP-NEXT: Cost Model: Found an estimated cost of 35 for instruction: %V4I32 = call { <4 x i32>, <4 x i1> } @llvm.umul.with.overflow.v4i32(<4 x i32> undef, <4 x i32> undef)
443445
; RECIP-NEXT: Cost Model: Found an estimated cost of 70 for instruction: %V8I32 = call { <8 x i32>, <8 x i1> } @llvm.umul.with.overflow.v8i32(<8 x i32> undef, <8 x i32> undef)
@@ -447,9 +449,9 @@ define i32 @umul(i32 %arg) {
447449
; RECIP-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V16I16 = call { <16 x i16>, <16 x i1> } @llvm.umul.with.overflow.v16i16(<16 x i16> undef, <16 x i16> undef)
448450
; RECIP-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V32I16 = call { <32 x i16>, <32 x i1> } @llvm.umul.with.overflow.v32i16(<32 x i16> undef, <32 x i16> undef)
449451
; RECIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %I8 = call { i8, i1 } @llvm.umul.with.overflow.i8(i8 undef, i8 undef)
450-
; RECIP-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %V16I8 = call { <16 x i8>, <16 x i1> } @llvm.umul.with.overflow.v16i8(<16 x i8> undef, <16 x i8> undef)
451-
; RECIP-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V32I8 = call { <32 x i8>, <32 x i1> } @llvm.umul.with.overflow.v32i8(<32 x i8> undef, <32 x i8> undef)
452-
; RECIP-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V64I8 = call { <64 x i8>, <64 x i1> } @llvm.umul.with.overflow.v64i8(<64 x i8> undef, <64 x i8> undef)
452+
; RECIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V16I8 = call { <16 x i8>, <16 x i1> } @llvm.umul.with.overflow.v16i8(<16 x i8> undef, <16 x i8> undef)
453+
; RECIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %V32I8 = call { <32 x i8>, <32 x i1> } @llvm.umul.with.overflow.v32i8(<32 x i8> undef, <32 x i8> undef)
454+
; RECIP-NEXT: Cost Model: Found an estimated cost of 44 for instruction: %V64I8 = call { <64 x i8>, <64 x i1> } @llvm.umul.with.overflow.v64i8(<64 x i8> undef, <64 x i8> undef)
453455
; RECIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
454456
;
455457
; SIZE-LABEL: 'umul'

llvm/test/Analysis/CostModel/AArch64/cast.ll

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=aarch64-none-linux-gnueabi %s | FileCheck --check-prefixes=CHECK,CHECK-NOFP16 %s
33
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=aarch64-none-linux-gnueabi -mattr=+fullfp16 %s | FileCheck --check-prefixes=CHECK,CHECK-FP16 %s
44

5+
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6+
57
define void @ext() {
68
; CHECK-LABEL: 'ext'
79
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r0 = sext i1 undef to i8
@@ -165,25 +167,25 @@ define void @trunc() {
165167
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s2i8i32 = trunc <2 x i32> undef to <2 x i8>
166168
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s2i8i64 = trunc <2 x i64> undef to <2 x i8>
167169
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s2i16i32 = trunc <2 x i32> undef to <2 x i16>
168-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s2i16i64 = trunc <2 x i64> undef to <2 x i16>
169-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s2i32i64 = trunc <2 x i64> undef to <2 x i32>
170+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s2i16i64 = trunc <2 x i64> undef to <2 x i16>
171+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s2i32i64 = trunc <2 x i64> undef to <2 x i32>
170172
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s4i8i16 = trunc <4 x i16> undef to <4 x i8>
171-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s4i8i32 = trunc <4 x i32> undef to <4 x i8>
172-
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s4i8i64 = trunc <4 x i64> undef to <4 x i8>
173+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s4i8i32 = trunc <4 x i32> undef to <4 x i8>
174+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s4i8i64 = trunc <4 x i64> undef to <4 x i8>
173175
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s4i16i32 = trunc <4 x i32> undef to <4 x i16>
174-
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s4i16i64 = trunc <4 x i64> undef to <4 x i16>
176+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s4i16i64 = trunc <4 x i64> undef to <4 x i16>
175177
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s4i32i64 = trunc <4 x i64> undef to <4 x i32>
176-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s8i8i16 = trunc <8 x i16> undef to <8 x i8>
178+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s8i8i16 = trunc <8 x i16> undef to <8 x i8>
177179
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s8i8i32 = trunc <8 x i32> undef to <8 x i8>
178-
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %s8i8i64 = trunc <8 x i64> undef to <8 x i8>
180+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s8i8i64 = trunc <8 x i64> undef to <8 x i8>
179181
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s8i16i32 = trunc <8 x i32> undef to <8 x i16>
180-
; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %s8i16i64 = trunc <8 x i64> undef to <8 x i16>
182+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s8i16i64 = trunc <8 x i64> undef to <8 x i16>
181183
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s8i32i64 = trunc <8 x i64> undef to <8 x i32>
182-
; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s16i8i16 = trunc <16 x i16> undef to <16 x i8>
184+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s16i8i16 = trunc <16 x i16> undef to <16 x i8>
183185
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %s16i8i32 = trunc <16 x i32> undef to <16 x i8>
184-
; CHECK-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %s16i8i64 = trunc <16 x i64> undef to <16 x i8>
186+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %s16i8i64 = trunc <16 x i64> undef to <16 x i8>
185187
; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %s16i16i32 = trunc <16 x i32> undef to <16 x i16>
186-
; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %s16i16i64 = trunc <16 x i64> undef to <16 x i16>
188+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %s16i16i64 = trunc <16 x i64> undef to <16 x i16>
187189
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %s16i32i64 = trunc <16 x i64> undef to <16 x i32>
188190
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
189191
;
@@ -680,10 +682,10 @@ define i32 @casts_with_users(i8 %a, i16 %b, i32 %c, i64 %d, i1 %e) {
680682
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r5 = sext i32 %c to i64
681683
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %r0, i16* undef, align 2
682684
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r1, i32* undef, align 4
683-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r2, i64* undef, align 4
685+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r2, i64* undef, align 8
684686
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r3, i32* undef, align 4
685-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r4, i64* undef, align 4
686-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r5, i64* undef, align 4
687+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r4, i64* undef, align 8
688+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r5, i64* undef, align 8
687689
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r6 = zext i8 %a to i16
688690
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r7 = zext i8 %a to i32
689691
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r8 = zext i8 %a to i64
@@ -692,10 +694,10 @@ define i32 @casts_with_users(i8 %a, i16 %b, i32 %c, i64 %d, i1 %e) {
692694
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r11 = zext i32 %c to i64
693695
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %r6, i16* undef, align 2
694696
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r7, i32* undef, align 4
695-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r8, i64* undef, align 4
697+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r8, i64* undef, align 8
696698
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r9, i32* undef, align 4
697-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r10, i64* undef, align 4
698-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r11, i64* undef, align 4
699+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r10, i64* undef, align 8
700+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r11, i64* undef, align 8
699701
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r12 = trunc i64 %d to i32
700702
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r13 = trunc i64 %d to i16
701703
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r14 = trunc i64 %d to i8
@@ -722,11 +724,11 @@ define i32 @casts_with_users(i8 %a, i16 %b, i32 %c, i64 %d, i1 %e) {
722724
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i8 %r18, i8* undef, align 1
723725
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %r19, i16* undef, align 2
724726
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r20, i32* undef, align 4
725-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r21, i64* undef, align 4
727+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r21, i64* undef, align 8
726728
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i8 %r22, i8* undef, align 1
727729
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %r23, i16* undef, align 2
728730
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %r24, i32* undef, align 4
729-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r25, i64* undef, align 4
731+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %r25, i64* undef, align 8
730732
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r12
731733
;
732734
%r0 = sext i8 %a to i16

0 commit comments

Comments
 (0)