| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py |
| ; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve.fp < %s | FileCheck %s --check-prefix=CHECK-MVE |
| ; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8m.main-none-eabi < %s | FileCheck %s --check-prefix=CHECK-V8M-MAIN |
| ; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8m.base-none-eabi < %s | FileCheck %s --check-prefix=CHECK-V8M-BASE |
| ; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=armv8r-none-eabi -mattr=+neon,+fp-armv8 < %s | FileCheck %s --check-prefix=CHECK-V8R |
| |
| target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" |
| |
| define i32 @cmps() { |
| ; CHECK-MVE-LABEL: 'cmps' |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %e = icmp slt <16 x i8> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %f = icmp ult <8 x i16> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %g = icmp sge <4 x i32> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %a10 = fcmp olt <8 x half> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %a11 = fcmp oge <4 x float> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:8 for: %a12 = fcmp oge <2 x double> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %q = icmp eq <4 x ptr> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef |
| ; |
| ; CHECK-V8M-MAIN-LABEL: 'cmps' |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 32 for: %e = icmp slt <16 x i8> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 16 for: %f = icmp ult <8 x i16> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 8 for: %g = icmp sge <4 x i32> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 16 for: %a10 = fcmp olt <8 x half> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 8 for: %a11 = fcmp oge <4 x float> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 6 for: %a12 = fcmp oge <2 x double> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 8 for: %q = icmp eq <4 x ptr> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: ret i32 undef |
| ; |
| ; CHECK-V8M-BASE-LABEL: 'cmps' |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 32 for: %e = icmp slt <16 x i8> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 16 for: %f = icmp ult <8 x i16> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 8 for: %g = icmp sge <4 x i32> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 16 for: %a10 = fcmp olt <8 x half> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 8 for: %a11 = fcmp oge <4 x float> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 6 for: %a12 = fcmp oge <2 x double> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 8 for: %q = icmp eq <4 x ptr> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: ret i32 undef |
| ; |
| ; CHECK-V8R-LABEL: 'cmps' |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %e = icmp slt <16 x i8> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %f = icmp ult <8 x i16> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %g = icmp sge <4 x i32> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 24 for: %a10 = fcmp olt <8 x half> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %a11 = fcmp oge <4 x float> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 4 for: %a12 = fcmp oge <2 x double> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %q = icmp eq <4 x ptr> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef |
| ; |
| %a = icmp slt i8 undef, undef |
| %b = icmp ult i16 undef, undef |
| %c = icmp sge i32 undef, undef |
| %d = icmp ne i64 undef, undef |
| %e = icmp slt <16 x i8> undef, undef |
| %f = icmp ult <8 x i16> undef, undef |
| %g = icmp sge <4 x i32> undef, undef |
| %a7 = fcmp oge half undef, undef |
| %a8 = fcmp ogt float undef, undef |
| %a9 = fcmp ogt double undef, undef |
| %a10 = fcmp olt <8 x half> undef, undef |
| %a11 = fcmp oge <4 x float> undef, undef |
| %a12 = fcmp oge <2 x double> undef, undef |
| %p = icmp eq ptr undef, undef |
| %q = icmp eq <4 x ptr> undef, undef |
| ret i32 undef |
| } |
| |
| define void @minmax() { |
| ; CHECK-MVE-LABEL: 'minmax' |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %c6 = icmp slt <4 x ptr> undef, undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef |
| ; CHECK-MVE-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void |
| ; |
| ; CHECK-V8M-MAIN-LABEL: 'minmax' |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:16 CodeSize:20 Lat:16 SizeLat:16 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 8 for: %c6 = icmp slt <4 x ptr> undef, undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of RThru:8 CodeSize:12 Lat:8 SizeLat:8 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef |
| ; CHECK-V8M-MAIN-NEXT: Cost Model: Found costs of 1 for: ret void |
| ; |
| ; CHECK-V8M-BASE-LABEL: 'minmax' |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:16 CodeSize:20 Lat:16 SizeLat:16 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 8 for: %c6 = icmp slt <4 x ptr> undef, undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of RThru:8 CodeSize:12 Lat:8 SizeLat:8 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef |
| ; CHECK-V8M-BASE-NEXT: Cost Model: Found costs of 1 for: ret void |
| ; |
| ; CHECK-V8R-LABEL: 'minmax' |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s1 = select i1 %c1, i8 undef, i8 undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s2 = select i1 %c2, i16 undef, i16 undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s3 = select i1 %c3, i32 undef, i32 undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s5 = select i1 %c5, ptr undef, ptr undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %c6 = icmp slt <4 x ptr> undef, undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of 1 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef |
| ; CHECK-V8R-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void |
| ; |
| %c1 = icmp slt i8 undef, undef |
| %s1 = select i1 %c1, i8 undef, i8 undef |
| %c2 = icmp slt i16 undef, undef |
| %s2 = select i1 %c2, i16 undef, i16 undef |
| %c3 = icmp slt i32 undef, undef |
| %s3 = select i1 %c3, i32 undef, i32 undef |
| %c4 = icmp slt <4 x i32> undef, undef |
| %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef |
| %c5 = icmp slt ptr undef, undef |
| %s5 = select i1 %c5, ptr undef, ptr undef |
| %c6 = icmp slt <4 x ptr> undef, undef |
| %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef |
| ret void |
| } |