[llvm] r358699 - [PowerPC] Add some PPC vec cost tests to prep for D60160 NFC

Roland Froese via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 11:12:09 PDT 2019


Author: froese
Date: Thu Apr 18 11:12:09 2019
New Revision: 358699

URL: http://llvm.org/viewvc/llvm-project?rev=358699&view=rev
Log:
[PowerPC] Add some PPC vec cost tests to prep for D60160 NFC

Added:
    llvm/trunk/test/Analysis/CostModel/PowerPC/vector_unit.ll
      - copied, changed from r358698, llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll
Removed:
    llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll
Modified:
    llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll

Modified: llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll?rev=358699&r1=358698&r2=358699&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll (original)
+++ llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll Thu Apr 18 11:12:09 2019
@@ -1,16 +1,187 @@
-; RUN: opt < %s  -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx | FileCheck --check-prefix=CHECK-P7 %s
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=+vsx | FileCheck --check-prefix=CHECK-P8LE %s
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9BE %s
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9LE %s
+
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
 define i32 @insert(i32 %arg) {
   ; CHECK: cost of 10 {{.*}} insertelement
+; CHECK-P7-LABEL: 'insert'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
+;
+; CHECK-P8LE-LABEL: 'insert'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
+;
+; CHECK-P9BE-LABEL: 'insert'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
+;
+; CHECK-P9LE-LABEL: 'insert'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
+;
   %x = insertelement <4 x i32> undef, i32 %arg, i32 0
   ret i32 undef
 }
 
 define i32 @extract(<4 x i32> %arg) {
   ; CHECK: cost of 3 {{.*}} extractelement
+; CHECK-P7-LABEL: 'extract'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
+;
+; CHECK-P8LE-LABEL: 'extract'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
+;
+; CHECK-P9BE-LABEL: 'extract'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = extractelement <4 x i32> %arg, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
+;
+; CHECK-P9LE-LABEL: 'extract'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = extractelement <4 x i32> %arg, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
+;
   %x = extractelement <4 x i32> %arg, i32 0
   ret i32 %x
 }
 
+define void @test2xdouble(<2 x double> %arg1) {
+; CHECK-P7-LABEL: 'test2xdouble'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P8LE-LABEL: 'test2xdouble'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9BE-LABEL: 'test2xdouble'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9LE-LABEL: 'test2xdouble'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %v1 = extractelement <2 x double> %arg1, i32 0
+  %v2 = extractelement <2 x double> %arg1, i32 1
+  ret void
+}
+
+define void @test4xi32(<4 x i32> %v1, i32 %x1) {
+; CHECK-P7-LABEL: 'test4xi32'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P8LE-LABEL: 'test4xi32'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9BE-LABEL: 'test4xi32'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9LE-LABEL: 'test4xi32'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
+  ret void
+}
+
+define void @vexti32(<4 x i32> %p1) {
+; CHECK-P7-LABEL: 'vexti32'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P8LE-LABEL: 'vexti32'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9BE-LABEL: 'vexti32'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9LE-LABEL: 'vexti32'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %i1 = extractelement <4 x i32> %p1, i32 0
+  %i2 = extractelement <4 x i32> %p1, i32 1
+  %i3 = extractelement <4 x i32> %p1, i32 2
+  %i4 = extractelement <4 x i32> %p1, i32 3
+  ret void
+}
+
+define void @vexti64(<2 x i64> %p1) {
+; CHECK-P7-LABEL: 'vexti64'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P8LE-LABEL: 'vexti64'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9BE-LABEL: 'vexti64'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9LE-LABEL: 'vexti64'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %i1 = extractelement <2 x i64> %p1, i32 0
+  %i2 = extractelement <2 x i64> %p1, i32 1
+  ret void
+}
+
+define void @vext(<8 x i16> %p1, <16 x i8> %p2) {
+; CHECK-P7-LABEL: 'vext'
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
+; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P8LE-LABEL: 'vext'
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
+; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9BE-LABEL: 'vext'
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
+; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; CHECK-P9LE-LABEL: 'vext'
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
+; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+  %i1 = extractelement <8 x i16> %p1, i32 0
+  %i2 = extractelement <16 x i8> %p2, i32 0
+  ret void
+}

Removed: llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll?rev=358698&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll (original)
+++ llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll (removed)
@@ -1,68 +0,0 @@
-; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx | FileCheck %s
-; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9 %s
-; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-LE %s
-
-define void @testi16(i16 %arg1, i16 %arg2, i16* %arg3) {
-
-  %s1 = add i16 %arg1, %arg2
-  %s2 = zext i16 %arg1 to i32
-  %s3 = load i16, i16* %arg3
-  store i16 %arg2, i16* %arg3
-  %c = icmp eq i16 %arg1, %arg2
-
-  ret void
-  ; CHECK: cost of 1 {{.*}} add
-  ; CHECK: cost of 1 {{.*}} zext
-  ; CHECK: cost of 1 {{.*}} load
-  ; CHECK: cost of 1 {{.*}} store
-  ; CHECK: cost of 1 {{.*}} icmp
-  ; CHECK-P9: cost of 1 {{.*}} add
-  ; CHECK-P9: cost of 1 {{.*}} zext
-  ; CHECK-P9: cost of 1 {{.*}} load
-  ; CHECK-P9: cost of 1 {{.*}} store
-  ; CHECK-P9: cost of 1 {{.*}} icmp
-}
-
-define void @test4xi16(<4 x i16> %arg1, <4 x i16> %arg2) {
-
-  %v1 = add <4 x i16> %arg1, %arg2
-  %v2 = zext <4 x i16> %arg1 to <4 x i32>
-  %v3 = shufflevector <4 x i16> %arg1, <4 x i16> undef, <4 x i32> zeroinitializer
-  %c = icmp eq <4 x i16> %arg1, %arg2
-
-  ret void
-  ; CHECK: cost of 1 {{.*}} add
-  ; CHECK: cost of 1 {{.*}} zext
-  ; CHECK: cost of 1 {{.*}} shufflevector
-  ; CHECK: cost of 1 {{.*}} icmp
-  ; CHECK-P9: cost of 2 {{.*}} add
-  ; CHECK-P9: cost of 2 {{.*}} zext
-  ; CHECK-P9: cost of 2 {{.*}} shufflevector
-  ; CHECK-P9: cost of 2 {{.*}} icmp
-}
-
-define void @test4xi32(<4 x i32> %arg1, <4 x i32> %arg2, <4 x i32>* %arg3) {
-
-  %v1 = load <4 x i32>, <4 x i32>* %arg3
-  store <4 x i32> %arg2, <4 x i32>* %arg3
-
-  ret void
-  ; CHECK: cost of 1 {{.*}} load
-  ; CHECK: cost of 1 {{.*}} store
-  ; CHECK-P9: cost of 2 {{.*}} load
-  ; CHECK-P9: cost of 2 {{.*}} store
-}
-
-define void @test2xdouble(<2 x double> %arg1) {
-  %v1 = extractelement <2 x double> %arg1, i32 0
-  %v2 = extractelement <2 x double> %arg1, i32 1
-
-  ret void
-  ; CHECK: cost of 0 {{.*}} extractelement
-  ; CHECK: cost of 1 {{.*}} extractelement
-  ; CHECK-P9: cost of 0 {{.*}} extractelement
-  ; CHECK-P9: cost of 2 {{.*}} extractelement
-  ; CHECK-LE-LABEL: test2xdouble
-  ; CHECK-LE: cost of 2 {{.*}} extractelement
-  ; CHECK-LE: cost of 0 {{.*}} extractelement
-}

Copied: llvm/trunk/test/Analysis/CostModel/PowerPC/vector_unit.ll (from r358698, llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/PowerPC/vector_unit.ll?p2=llvm/trunk/test/Analysis/CostModel/PowerPC/vector_unit.ll&p1=llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll&r1=358698&r2=358699&rev=358699&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/PowerPC/p9.ll (original)
+++ llvm/trunk/test/Analysis/CostModel/PowerPC/vector_unit.ll Thu Apr 18 11:12:09 2019
@@ -1,6 +1,5 @@
 ; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx | FileCheck %s
 ; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9 %s
-; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-LE %s
 
 define void @testi16(i16 %arg1, i16 %arg2, i16* %arg3) {
 
@@ -52,17 +51,3 @@ define void @test4xi32(<4 x i32> %arg1,
   ; CHECK-P9: cost of 2 {{.*}} load
   ; CHECK-P9: cost of 2 {{.*}} store
 }
-
-define void @test2xdouble(<2 x double> %arg1) {
-  %v1 = extractelement <2 x double> %arg1, i32 0
-  %v2 = extractelement <2 x double> %arg1, i32 1
-
-  ret void
-  ; CHECK: cost of 0 {{.*}} extractelement
-  ; CHECK: cost of 1 {{.*}} extractelement
-  ; CHECK-P9: cost of 0 {{.*}} extractelement
-  ; CHECK-P9: cost of 2 {{.*}} extractelement
-  ; CHECK-LE-LABEL: test2xdouble
-  ; CHECK-LE: cost of 2 {{.*}} extractelement
-  ; CHECK-LE: cost of 0 {{.*}} extractelement
-}




More information about the llvm-commits mailing list