From 1313d75cd2e7058bd7bf826b5245ee0fda0bc592 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 20 Jun 2017 17:10:27 +0000 Subject: [PATCH] [CostModel][X86] Add scalar arithmetic cost tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305810 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/CostModel/X86/arith.ll | 62 ++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/test/Analysis/CostModel/X86/arith.ll b/test/Analysis/CostModel/X86/arith.ll index 75ee0f71db6..d9e06a3e7b4 100644 --- a/test/Analysis/CostModel/X86/arith.ll +++ b/test/Analysis/CostModel/X86/arith.ll @@ -1,16 +1,18 @@ -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+ssse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SSSE3 -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse4.2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE42 -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512F -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512BW -; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512DQ +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+ssse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SSSE3 +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse4.2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE42 +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512F +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512BW +; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512DQ 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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0" ; CHECK-LABEL: 'add' define i32 @add(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = add + %I64 = add i64 undef, undef ; SSSE3: cost of 1 {{.*}} %V2I64 = add ; SSE42: cost of 1 {{.*}} %V2I64 = add ; AVX: cost of 1 {{.*}} %V2I64 = add @@ -30,6 +32,8 @@ define i32 @add(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V8I64 = add %V8I64 = add <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = add + %I32 = add i32 undef, undef ; SSSE3: cost of 1 {{.*}} %V4I32 = add ; SSE42: cost of 1 {{.*}} %V4I32 = add ; AVX: cost of 1 {{.*}} %V4I32 = add @@ -49,6 +53,8 @@ define i32 @add(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = add %V16I32 = add <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = add + %I16 = add i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = add ; SSE42: cost of 1 {{.*}} %V8I16 = add ; AVX: cost of 1 {{.*}} %V8I16 = add @@ -69,6 +75,8 @@ define i32 @add(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = add %V32I16 = add <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = add + %I8 = add i8 undef, undef ; SSSE3: cost of 1 {{.*}} %V16I8 = add ; SSE42: cost of 1 {{.*}} %V16I8 = add ; AVX: cost of 1 {{.*}} %V16I8 = add @@ -94,6 +102,8 @@ define i32 @add(i32 %arg) { ; CHECK-LABEL: 'sub' define i32 @sub(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = sub + %I64 = sub i64 undef, undef ; SSSE3: cost of 1 {{.*}} %V2I64 = sub ; SSE42: cost of 1 {{.*}} %V2I64 = sub ; AVX: cost of 1 {{.*}} %V2I64 = sub @@ -113,6 +123,8 @@ define i32 @sub(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V8I64 = sub %V8I64 = sub <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = sub + %I32 = sub i32 undef, undef ; SSSE3: cost of 1 {{.*}} %V4I32 = sub ; SSE42: cost of 1 {{.*}} %V4I32 = sub ; AVX: cost of 1 {{.*}} %V4I32 = sub @@ -132,6 +144,8 @@ define i32 @sub(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = sub %V16I32 = sub <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = sub + %I16 = sub i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = sub ; SSE42: cost of 1 {{.*}} %V8I16 = sub ; AVX: cost of 1 {{.*}} %V8I16 = sub @@ -152,6 +166,8 @@ define i32 @sub(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = sub %V32I16 = sub <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = sub + %I8 = sub i8 undef, undef ; SSSE3: cost of 1 {{.*}} %V16I8 = sub ; SSE42: cost of 1 {{.*}} %V16I8 = sub ; AVX: cost of 1 {{.*}} %V16I8 = sub @@ -177,6 +193,8 @@ define i32 @sub(i32 %arg) { ; CHECK-LABEL: 'or' define i32 @or(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = or + %I64 = or i64 undef, undef ; SSSE3: cost of 1 {{.*}} %V2I64 = or ; SSE42: cost of 1 {{.*}} %V2I64 = or ; AVX: cost of 1 {{.*}} %V2I64 = or @@ -196,6 +214,8 @@ define i32 @or(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V8I64 = or %V8I64 = or <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = or + %I32 = or i32 undef, undef ; SSSE3: cost of 1 {{.*}} %V4I32 = or ; SSE42: cost of 1 {{.*}} %V4I32 = or ; AVX: cost of 1 {{.*}} %V4I32 = or @@ -215,6 +235,8 @@ define i32 @or(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = or %V16I32 = or <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = or + %I16 = or i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = or ; SSE42: cost of 1 {{.*}} %V8I16 = or ; AVX: cost of 1 {{.*}} %V8I16 = or @@ -235,6 +257,8 @@ define i32 @or(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = or %V32I16 = or <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = or + %I8 = or i8 undef, undef ; SSSE3: cost of 1 {{.*}} %V16I8 = or ; SSE42: cost of 1 {{.*}} %V16I8 = or ; AVX: cost of 1 {{.*}} %V16I8 = or @@ -260,6 +284,8 @@ define i32 @or(i32 %arg) { ; CHECK-LABEL: 'xor' define i32 @xor(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = xor + %I64 = xor i64 undef, undef ; SSSE3: cost of 1 {{.*}} %V2I64 = xor ; SSE42: cost of 1 {{.*}} %V2I64 = xor ; AVX: cost of 1 {{.*}} %V2I64 = xor @@ -279,6 +305,8 @@ define i32 @xor(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V8I64 = xor %V8I64 = xor <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = xor + %I32 = xor i32 undef, undef ; SSSE3: cost of 1 {{.*}} %V4I32 = xor ; SSE42: cost of 1 {{.*}} %V4I32 = xor ; AVX: cost of 1 {{.*}} %V4I32 = xor @@ -298,6 +326,8 @@ define i32 @xor(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = xor %V16I32 = xor <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = xor + %I16 = xor i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = xor ; SSE42: cost of 1 {{.*}} %V8I16 = xor ; AVX: cost of 1 {{.*}} %V8I16 = xor @@ -318,6 +348,8 @@ define i32 @xor(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = xor %V32I16 = xor <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = xor + %I8 = xor i8 undef, undef ; SSSE3: cost of 1 {{.*}} %V16I8 = xor ; SSE42: cost of 1 {{.*}} %V16I8 = xor ; AVX: cost of 1 {{.*}} %V16I8 = xor @@ -343,6 +375,8 @@ define i32 @xor(i32 %arg) { ; CHECK-LABEL: 'and' define i32 @and(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = and + %I64 = and i64 undef, undef ; SSSE3: cost of 1 {{.*}} %V2I64 = and ; SSE42: cost of 1 {{.*}} %V2I64 = and ; AVX: cost of 1 {{.*}} %V2I64 = and @@ -362,6 +396,8 @@ define i32 @and(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V8I64 = and %V8I64 = and <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = and + %I32 = and i32 undef, undef ; SSSE3: cost of 1 {{.*}} %V4I32 = and ; SSE42: cost of 1 {{.*}} %V4I32 = and ; AVX: cost of 1 {{.*}} %V4I32 = and @@ -381,6 +417,8 @@ define i32 @and(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = and %V16I32 = and <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = and + %I16 = and i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = and ; SSE42: cost of 1 {{.*}} %V8I16 = and ; AVX: cost of 1 {{.*}} %V8I16 = and @@ -401,6 +439,8 @@ define i32 @and(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = and %V32I16 = and <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = and + %I8 = and i8 undef, undef ; SSSE3: cost of 1 {{.*}} %V16I8 = and ; SSE42: cost of 1 {{.*}} %V16I8 = and ; AVX: cost of 1 {{.*}} %V16I8 = and @@ -426,6 +466,8 @@ define i32 @and(i32 %arg) { ; CHECK-LABEL: 'mul' define i32 @mul(i32 %arg) { + ; CHECK: cost of 1 {{.*}} %I64 = mul + %I64 = mul i64 undef, undef ; SSSE3: cost of 8 {{.*}} %V2I64 = mul ; SSE42: cost of 8 {{.*}} %V2I64 = mul ; AVX: cost of 8 {{.*}} %V2I64 = mul @@ -451,6 +493,8 @@ define i32 @mul(i32 %arg) { ; AVX512DQ: cost of 1 {{.*}} %V8I64 = mul %V8I64 = mul <8 x i64> undef, undef + ; CHECK: cost of 1 {{.*}} %I32 = mul + %I32 = mul i32 undef, undef ; SSSE3: cost of 6 {{.*}} %V4I32 = mul ; SSE42: cost of 1 {{.*}} %V4I32 = mul ; AVX: cost of 1 {{.*}} %V4I32 = mul @@ -470,6 +514,8 @@ define i32 @mul(i32 %arg) { ; AVX512: cost of 1 {{.*}} %V16I32 = mul %V16I32 = mul <16 x i32> undef, undef + ; CHECK: cost of 1 {{.*}} %I16 = mul + %I16 = mul i16 undef, undef ; SSSE3: cost of 1 {{.*}} %V8I16 = mul ; SSE42: cost of 1 {{.*}} %V8I16 = mul ; AVX: cost of 1 {{.*}} %V8I16 = mul @@ -490,6 +536,8 @@ define i32 @mul(i32 %arg) { ; AVX512BW: cost of 1 {{.*}} %V32I16 = mul %V32I16 = mul <32 x i16> undef, undef + ; CHECK: cost of 1 {{.*}} %I8 = mul + %I8 = mul i8 undef, undef ; SSSE3: cost of 12 {{.*}} %V16I8 = mul ; SSE42: cost of 12 {{.*}} %V16I8 = mul ; AVX: cost of 12 {{.*}} %V16I8 = mul -- 2.50.1