blob: 5bfff91355fb648df93d3035fb825633baf8137c [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=cortex-a510 | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT2 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=neoverse-n1 | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=neoverse-n2 | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=neoverse-v1 | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=neoverse-v2 | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=kryo | FileCheck --check-prefixes=CHECK,SLOW-LD1-LAT3 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-m1 | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-m2 | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-m3 | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-m4 | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-m5 | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=apple-latest | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mattr=+fast-ld1-single | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT4 %s
; RUN: opt < %s -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mcpu=cortex-a510 -mattr=+fast-ld1-single | FileCheck --check-prefixes=CHECK,FAST-LD1-LAT2 %s
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"
define void @vectorInstrCost() {
; CHECK-LABEL: 'vectorInstrCost'
; CHECK-NEXT: Cost Model: Found costs of RThru:3 CodeSize:2 Lat:3 SizeLat:3 for: %ta0 = extractelement <8 x i1> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:3 CodeSize:2 Lat:3 SizeLat:3 for: %ta1 = extractelement <8 x i1> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t1 = extractelement <8 x i8> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t2 = extractelement <8 x i8> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t3 = extractelement <4 x i16> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t4 = extractelement <4 x i16> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t5 = extractelement <2 x i32> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t6 = extractelement <2 x i32> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t7 = extractelement <2 x i64> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t8 = extractelement <2 x i64> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t9 = extractelement <4 x half> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t10 = extractelement <4 x half> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t11 = extractelement <2 x float> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t12 = extractelement <2 x float> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t13 = extractelement <2 x double> undef, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t14 = extractelement <2 x double> undef, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:3 CodeSize:2 Lat:3 SizeLat:3 for: %t31 = insertelement <8 x i1> undef, i1 false, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:3 CodeSize:2 Lat:3 SizeLat:3 for: %t41 = insertelement <8 x i1> undef, i1 true, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t30 = insertelement <8 x i8> undef, i8 0, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t40 = insertelement <8 x i8> undef, i8 1, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t50 = insertelement <4 x i16> undef, i16 2, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t60 = insertelement <4 x i16> undef, i16 3, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t70 = insertelement <2 x i32> undef, i32 4, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t80 = insertelement <2 x i32> undef, i32 5, i32 1
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t90 = insertelement <2 x i64> undef, i64 6, i32 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t100 = insertelement <2 x i64> undef, i64 7, i32 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t110 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t120 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t130 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t140 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 1
; CHECK-NEXT: Cost Model: Found costs of 0 for: %t150 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 0
; CHECK-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
; CHECK-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
;
%ta0 = extractelement <8 x i1> undef, i32 0
%ta1 = extractelement <8 x i1> undef, i32 1
%t1 = extractelement <8 x i8> undef, i32 0
%t2 = extractelement <8 x i8> undef, i32 1
%t3 = extractelement <4 x i16> undef, i32 0
%t4 = extractelement <4 x i16> undef, i32 1
%t5 = extractelement <2 x i32> undef, i32 0
%t6 = extractelement <2 x i32> undef, i32 1
%t7 = extractelement <2 x i64> undef, i32 0
%t8 = extractelement <2 x i64> undef, i32 1
%t9 = extractelement <4 x half> undef, i32 0
%t10 = extractelement <4 x half> undef, i32 1
%t11 = extractelement <2 x float> undef, i32 0
%t12 = extractelement <2 x float> undef, i32 1
%t13 = extractelement <2 x double> undef, i32 0
%t14 = extractelement <2 x double> undef, i32 1
%t31 = insertelement <8 x i1> undef, i1 0, i32 0
%t41 = insertelement <8 x i1> undef, i1 1, i32 1
%t30 = insertelement <8 x i8> undef, i8 0, i32 0
%t40 = insertelement <8 x i8> undef, i8 1, i32 1
%t50 = insertelement <4 x i16> undef, i16 2, i32 0
%t60 = insertelement <4 x i16> undef, i16 3, i32 1
%t70 = insertelement <2 x i32> undef, i32 4, i32 0
%t80 = insertelement <2 x i32> undef, i32 5, i32 1
%t90 = insertelement <2 x i64> undef, i64 6, i32 0
%t100 = insertelement <2 x i64> undef, i64 7, i32 1
%t110 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 0
%t120 = insertelement <4 x half> zeroinitializer, half 0.000000e+00, i64 1
%t130 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 0
%t140 = insertelement <2 x float> zeroinitializer, float 0.000000e+00, i64 1
%t150 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 0
%t160 = insertelement <2 x double> zeroinitializer, double 0.000000e+00, i64 1
ret void
}
;; LD1: Load one single-element structure to one lane of one register.
define <8 x i8> @LD1_B(<8 x i8> %vec, ptr noundef %i) {
; SLOW-LD1-LAT2-LABEL: 'LD1_B'
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; SLOW-LD1-LAT4-LABEL: 'LD1_B'
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; SLOW-LD1-LAT3-LABEL: 'LD1_B'
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; FAST-LD1-LAT4-LABEL: 'LD1_B'
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; FAST-LD1-LAT2-LABEL: 'LD1_B'
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
entry:
%v1 = load i8, ptr %i, align 1
%v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
ret <8x i8> %v2
}
define <4 x i16> @LD1_H(<4 x i16> %vec, ptr noundef %i) {
; SLOW-LD1-LAT2-LABEL: 'LD1_H'
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i16, ptr %i, align 2
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %v2
;
; SLOW-LD1-LAT4-LABEL: 'LD1_H'
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i16, ptr %i, align 2
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %v2
;
; SLOW-LD1-LAT3-LABEL: 'LD1_H'
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v1 = load i16, ptr %i, align 2
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %v2
;
; FAST-LD1-LAT4-LABEL: 'LD1_H'
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i16, ptr %i, align 2
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %v2
;
; FAST-LD1-LAT2-LABEL: 'LD1_H'
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i16, ptr %i, align 2
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i16> %v2
;
entry:
%v1 = load i16, ptr %i, align 2
%v2 = insertelement <4 x i16> %vec, i16 %v1, i32 2
ret <4 x i16> %v2
}
define <4 x i32> @LD1_W(<4 x i32> %vec, ptr noundef %i) {
; SLOW-LD1-LAT2-LABEL: 'LD1_W'
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i32, ptr %i, align 4
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %v2
;
; SLOW-LD1-LAT4-LABEL: 'LD1_W'
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i32, ptr %i, align 4
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %v2
;
; SLOW-LD1-LAT3-LABEL: 'LD1_W'
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v1 = load i32, ptr %i, align 4
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %v2
;
; FAST-LD1-LAT4-LABEL: 'LD1_W'
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i32, ptr %i, align 4
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %v2
;
; FAST-LD1-LAT2-LABEL: 'LD1_W'
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i32, ptr %i, align 4
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <4 x i32> %v2
;
entry:
%v1 = load i32, ptr %i, align 4
%v2 = insertelement <4 x i32> %vec, i32 %v1, i32 3
ret <4 x i32> %v2
}
define <2 x i64> @LD1_X(<2 x i64> %vec, ptr noundef %i) {
; SLOW-LD1-LAT2-LABEL: 'LD1_X'
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i64, ptr %i, align 8
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %v2
;
; SLOW-LD1-LAT4-LABEL: 'LD1_X'
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i64, ptr %i, align 8
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %v2
;
; SLOW-LD1-LAT3-LABEL: 'LD1_X'
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v1 = load i64, ptr %i, align 8
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:3 CodeSize:0 Lat:3 SizeLat:3 for: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %v2
;
; FAST-LD1-LAT4-LABEL: 'LD1_X'
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i64, ptr %i, align 8
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %v2
;
; FAST-LD1-LAT2-LABEL: 'LD1_X'
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i64, ptr %i, align 8
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of 0 for: %v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <2 x i64> %v2
;
entry:
%v1 = load i64, ptr %i, align 8
%v2 = insertelement <2 x i64> %vec, i64 %v1, i32 0
ret <2 x i64> %v2
}
;; Multi-use tests: Check that Load context is only applied when load has one use
define <8 x i8> @LD1_multi_use_load(<8 x i8> %vec, ptr noundef %i, ptr noundef %out) {
; SLOW-LD1-LAT2-LABEL: 'LD1_multi_use_load'
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of 1 for: store i8 %v1, ptr %out, align 1
; SLOW-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; SLOW-LD1-LAT4-LABEL: 'LD1_multi_use_load'
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of 1 for: store i8 %v1, ptr %out, align 1
; SLOW-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; SLOW-LD1-LAT3-LABEL: 'LD1_multi_use_load'
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:3 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of 1 for: store i8 %v1, ptr %out, align 1
; SLOW-LD1-LAT3-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; FAST-LD1-LAT4-LABEL: 'LD1_multi_use_load'
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of 1 for: store i8 %v1, ptr %out, align 1
; FAST-LD1-LAT4-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
; FAST-LD1-LAT2-LABEL: 'LD1_multi_use_load'
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:1 CodeSize:1 Lat:2 SizeLat:1 for: %v1 = load i8, ptr %i, align 1
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of 1 for: store i8 %v1, ptr %out, align 1
; FAST-LD1-LAT2-NEXT: Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret <8 x i8> %v2
;
entry:
%v1 = load i8, ptr %i, align 1
%v2 = insertelement <8 x i8> %vec, i8 %v1, i32 1
store i8 %v1, ptr %out, align 1 ; Load has multiple uses
ret <8 x i8> %v2
}