"fast-vector-shift-masks", "HasFastVectorShiftMasks", "true",
"Prefer a left/right vector logical shift pair over a shift+and pair">;
+def FeatureFastMOVBE
+ : SubtargetFeature<"fast-movbe", "HasFastMOVBE", "true",
+ "Prefer a movbe over a single-use load + bswap / single-use bswap + store">;
+
def FeatureUseGLMDivSqrtCosts
: SubtargetFeature<"use-glm-div-sqrt-costs", "UseGLMDivSqrtCosts", "true",
"Use Goldmont specific floating point div/sqrt costs">;
FeatureSlowDivide64,
FeatureSlowPMULLD,
FeatureFast7ByteNOP,
+ FeatureFastMOVBE,
FeaturePOPCNTFalseDeps,
FeatureInsertVZEROUPPER];
list<SubtargetFeature> SLMFeatures =
FeatureSlowTwoMemOps,
FeatureSlowLEA,
FeatureSlowIncDec,
+ FeatureFastMOVBE,
FeaturePOPCNTFalseDeps,
FeatureInsertVZEROUPPER];
list<SubtargetFeature> GLMFeatures =
FeatureSlowTwoMemOps,
FeatureSlowLEA,
FeatureSlowIncDec,
+ FeatureFastMOVBE,
FeatureInsertVZEROUPPER];
list<SubtargetFeature> GLPFeatures =
!listconcat(GLMFeatures, GLPAdditionalFeatures);
FeatureSlowTwoMemOps,
FeaturePreferMaskRegisters,
FeatureHasFastGather,
+ FeatureFastMOVBE,
FeatureSlowPMADDWD];
// TODO Add AVX5124FMAPS/AVX5124VNNIW features
list<SubtargetFeature> KNMFeatures =
FeatureFast15ByteNOP,
FeatureFastScalarShiftMasks,
FeatureFastVectorShiftMasks,
+ FeatureFastMOVBE,
FeatureSlowSHLD];
list<SubtargetFeature> BtVer2Features =
!listconcat(BtVer1Features, BtVer2AdditionalFeatures);
FeatureTBM,
FeatureFMA,
FeatureFastBEXTR];
- list<SubtargetFeature> BdVer2Tuning = BdVer1Tuning;
+ list<SubtargetFeature> BdVer2AdditionalTuning = [FeatureFastMOVBE];
+ list<SubtargetFeature> BdVer2Tuning =
+ !listconcat(BdVer1Tuning, BdVer2AdditionalTuning);
list<SubtargetFeature> BdVer2Features =
!listconcat(BdVer1Features, BdVer2AdditionalFeatures);
FeatureFast15ByteNOP,
FeatureBranchFusion,
FeatureFastScalarShiftMasks,
+ FeatureFastMOVBE,
FeatureSlowSHLD,
FeatureInsertVZEROUPPER];
list<SubtargetFeature> ZN2AdditionalFeatures = [FeatureCLWB,
/// Prefer a left/right vector logical shifts pair over a shift+and pair.
bool HasFastVectorShiftMasks = false;
+ /// Prefer a movbe over a single-use load + bswap / single-use bswap + store.
+ bool HasFastMOVBE = false;
+
/// Use a retpoline thunk rather than indirect calls to block speculative
/// execution.
bool UseRetpolineIndirectCalls = false;
bool hasFastHorizontalOps() const { return HasFastHorizontalOps; }
bool hasFastScalarShiftMasks() const { return HasFastScalarShiftMasks; }
bool hasFastVectorShiftMasks() const { return HasFastVectorShiftMasks; }
+ bool hasFastMOVBE() const { return HasFastMOVBE; }
bool hasMacroFusion() const { return HasMacroFusion; }
bool hasBranchFusion() const { return HasBranchFusion; }
bool hasERMSB() const { return HasERMSB; }
static const CostTblEntry X64CostTbl[] = { // 64-bit targets
{ ISD::ABS, MVT::i64, 2 }, // SUB+CMOV
{ ISD::BITREVERSE, MVT::i64, 14 },
+ { ISD::BSWAP, MVT::i64, 1 },
{ ISD::CTLZ, MVT::i64, 4 }, // BSR+XOR or BSR+XOR+CMOV
{ ISD::CTTZ, MVT::i64, 3 }, // TEST+BSF+CMOV/BRANCH
{ ISD::CTPOP, MVT::i64, 10 },
{ ISD::BITREVERSE, MVT::i32, 14 },
{ ISD::BITREVERSE, MVT::i16, 14 },
{ ISD::BITREVERSE, MVT::i8, 11 },
+ { ISD::BSWAP, MVT::i32, 1 },
+ { ISD::BSWAP, MVT::i16, 1 }, // ROL
{ ISD::CTLZ, MVT::i32, 4 }, // BSR+XOR or BSR+XOR+CMOV
{ ISD::CTLZ, MVT::i16, 4 }, // BSR+XOR or BSR+XOR+CMOV
{ ISD::CTLZ, MVT::i8, 4 }, // BSR+XOR or BSR+XOR+CMOV
return adjustTableCost(*Entry, LT.first, ICA.getFlags());
}
+ if (ISD == ISD::BSWAP && ST->hasMOVBE() && ST->hasFastMOVBE()) {
+ if (const Instruction *II = ICA.getInst()) {
+ if (II->hasOneUse() && isa<StoreInst>(II->user_back()))
+ return TTI::TCC_Free;
+ if (auto *LI = dyn_cast<LoadInst>(II->getOperand(0))) {
+ if (LI->hasOneUse())
+ return TTI::TCC_Free;
+ }
+ }
+ }
+
// TODO - add BMI (TZCNT) scalar handling
if (ST->is64Bit())
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X64
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X64
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X86
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X86
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X64
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X64-MOVBE
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE
+
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X32
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X32-MOVBE
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE
declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
declare i128 @llvm.bswap.i128(i128)
define void @var_bswap_store_i16(i16 %a, i16* %dst) {
-; NOMOVBE-LABEL: 'var_bswap_store_i16'
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-LABEL: 'var_bswap_store_i16'
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-MOVBE-LABEL: 'var_bswap_store_i16'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i16'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
-; MOVBE-LABEL: 'var_bswap_store_i16'
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X32-LABEL: 'var_bswap_store_i16'
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i16'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i16'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i16 @llvm.bswap.i16(i16 %a)
store i16 %bswap, i16* %dst, align 1
ret void
}
define void @var_bswap_store_i16_extrause(i16 %a, i16* %dst) {
-; NOMOVBE-LABEL: 'var_bswap_store_i16_extrause'
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i16 %bswap, 2
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
-;
-; MOVBE-LABEL: 'var_bswap_store_i16_extrause'
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i16 %bswap, 2
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; ALL-LABEL: 'var_bswap_store_i16_extrause'
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %bswap, i16* %dst, align 1
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i16 %bswap, 2
+; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i16 @llvm.bswap.i16(i16 %a)
store i16 %bswap, i16* %dst, align 1
}
define void @var_bswap_store_i32(i32 %a, i32* %dst) {
-; ALL-LABEL: 'var_bswap_store_i32'
-; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
-; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
-; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-LABEL: 'var_bswap_store_i32'
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-MOVBE-LABEL: 'var_bswap_store_i32'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i32'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-LABEL: 'var_bswap_store_i32'
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i32'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i32'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i32 %bswap, i32* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i32 @llvm.bswap.i32(i32 %a)
store i32 %bswap, i32* %dst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, i64* %dst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
-; X86-LABEL: 'var_bswap_store_i64'
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-MOVBE-LABEL: 'var_bswap_store_i64'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, i64* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i64'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, i64* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-LABEL: 'var_bswap_store_i64'
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i64'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i64'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i64 @llvm.bswap.i64(i64 %a)
store i64 %bswap, i64* %dst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
-; X86-LABEL: 'var_bswap_store_i64_extrause'
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-MOVBE-LABEL: 'var_bswap_store_i64_extrause'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, i64* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i64_extrause'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %bswap, i64* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap2 = shl i64 %bswap, 2
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-LABEL: 'var_bswap_store_i64_extrause'
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i64_extrause'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i64_extrause'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %bswap, i64* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i64 %bswap, 2
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i64 @llvm.bswap.i64(i64 %a)
store i64 %bswap, i64* %dst, align 1
define void @var_bswap_store_i128(i128 %a, i128* %dst) {
; X64-LABEL: 'var_bswap_store_i128'
-; X64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
-; X86-LABEL: 'var_bswap_store_i128'
-; X86-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-MOVBE-LABEL: 'var_bswap_store_i128'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i128'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-LABEL: 'var_bswap_store_i128'
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i128'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i128'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i128 @llvm.bswap.i128(i128 %a)
store i128 %bswap, i128* %dst, align 1
}
define void @var_bswap_store_i128_extrause(i128 %a, i128* %dst) {
; X64-LABEL: 'var_bswap_store_i128_extrause'
-; X64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
-; X86-LABEL: 'var_bswap_store_i128_extrause'
-; X86-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+; X64-MOVBE-LABEL: 'var_bswap_store_i128_extrause'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X64-FASTMOVBE-LABEL: 'var_bswap_store_i128_extrause'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %bswap, i128* %dst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap2 = shl i128 %bswap, 2
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-LABEL: 'var_bswap_store_i128_extrause'
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-MOVBE-LABEL: 'var_bswap_store_i128_extrause'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
+;
+; X32-FASTMOVBE-LABEL: 'var_bswap_store_i128_extrause'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %bswap, i128* %dst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap2 = shl i128 %bswap, 2
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
%bswap = call i128 @llvm.bswap.i128(i128 %a)
store i128 %bswap, i128* %dst, align 1
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X64
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X64
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X86
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X86
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X64
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X64
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X86
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X86
declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
; Verify the cost of scalar bswap instructions.
define i16 @var_bswap_i16(i16 %a) {
-; NOMOVBE-LABEL: 'var_bswap_i16'
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
-;
-; MOVBE-LABEL: 'var_bswap_i16'
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+; ALL-LABEL: 'var_bswap_i16'
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
%bswap = call i16 @llvm.bswap.i16(i16 %a)
ret i16 %bswap
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
; X86-LABEL: 'var_bswap_i64'
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
%bswap = call i64 @llvm.bswap.i64(i64 %a)
define i128 @var_bswap_i128(i128 %a) {
; X64-LABEL: 'var_bswap_i128'
-; X64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
; X86-LABEL: 'var_bswap_i128'
-; X86-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
%bswap = call i128 @llvm.bswap.i128(i128 %a)
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X64
-; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X64
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,NOMOVBE,X86
-; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,MOVBE,X86
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X64
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X64-MOVBE
+; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE
+
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze | FileCheck %s --check-prefixes=ALL,X32
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe | FileCheck %s --check-prefixes=ALL,X32-MOVBE
+; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -cost-model -analyze -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE
declare i16 @llvm.bswap.i16(i16)
declare i32 @llvm.bswap.i32(i32)
declare i128 @llvm.bswap.i128(i128)
define i16 @var_load_bswap_i16(i16* %src) {
-; NOMOVBE-LABEL: 'var_load_bswap_i16'
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+; X64-LABEL: 'var_load_bswap_i16'
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+;
+; X64-MOVBE-LABEL: 'var_load_bswap_i16'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i16'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i16'
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
-; MOVBE-LABEL: 'var_load_bswap_i16'
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+; X32-MOVBE-LABEL: 'var_load_bswap_i16'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i16'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
%a = load i16, i16* %src, align 1
%bswap = call i16 @llvm.bswap.i16(i16 %a)
ret i16 %bswap
}
define i16 @var_load_bswap_i16_extrause(i16* %src, i16* %clobberdst) {
-; NOMOVBE-LABEL: 'var_load_bswap_i16_extrause'
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i16 %a, 2
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %a2, i16* %clobberdst, align 1
-; NOMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
-;
-; MOVBE-LABEL: 'var_load_bswap_i16_extrause'
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i16 %a, 2
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %a2, i16* %clobberdst, align 1
-; MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
+; ALL-LABEL: 'var_load_bswap_i16_extrause'
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, i16* %src, align 1
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i16 %a, 2
+; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i16 %a2, i16* %clobberdst, align 1
+; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
;
%a = load i16, i16* %src, align 1
%bswap = call i16 @llvm.bswap.i16(i16 %a)
}
define i32 @var_load_bswap_i32(i32* %src) {
-; ALL-LABEL: 'var_load_bswap_i32'
-; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
-; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
-; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+; X64-LABEL: 'var_load_bswap_i32'
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+;
+; X64-MOVBE-LABEL: 'var_load_bswap_i32'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i32'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i32'
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+;
+; X32-MOVBE-LABEL: 'var_load_bswap_i32'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i32'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, i32* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
;
%a = load i32, i32* %src, align 1
%bswap = call i32 @llvm.bswap.i32(i32 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
-; X86-LABEL: 'var_load_bswap_i64'
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+; X64-MOVBE-LABEL: 'var_load_bswap_i64'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, i64* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, i64* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i64'
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-MOVBE-LABEL: 'var_load_bswap_i64'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
%a = load i64, i64* %src, align 1
%bswap = call i64 @llvm.bswap.i64(i64 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, i64* %clobberdst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
-; X86-LABEL: 'var_load_bswap_i64_extrause'
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
-; X86-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, i64* %clobberdst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+; X64-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, i64* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, i64* %clobberdst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, i64* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, i64* %clobberdst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i64_extrause'
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
+; X32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, i64* %clobberdst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, i64* %clobberdst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, i64* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, i64* %clobberdst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
;
%a = load i64, i64* %src, align 1
%bswap = call i64 @llvm.bswap.i64(i64 %a)
define i128 @var_load_bswap_i128(i128* %src) {
; X64-LABEL: 'var_load_bswap_i128'
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
-; X64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
-; X86-LABEL: 'var_load_bswap_i128'
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+; X64-MOVBE-LABEL: 'var_load_bswap_i128'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i128'
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-MOVBE-LABEL: 'var_load_bswap_i128'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
%a = load i128, i128* %src, align 1
%bswap = call i128 @llvm.bswap.i128(i128 %a)
define i128 @var_load_bswap_i128_extrause(i128* %src, i128* %clobberdst) {
; X64-LABEL: 'var_load_bswap_i128_extrause'
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
-; X64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
; X64-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, i128* %clobberdst, align 1
; X64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
-; X86-LABEL: 'var_load_bswap_i128_extrause'
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
-; X86-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, i128* %clobberdst, align 1
-; X86-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+; X64-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, i128* %clobberdst, align 1
+; X64-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, i128* %src, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, i128* %clobberdst, align 1
+; X64-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-LABEL: 'var_load_bswap_i128_extrause'
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
+; X32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, i128* %clobberdst, align 1
+; X32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, i128* %clobberdst, align 1
+; X32-MOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
+;
+; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, i128* %src, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, i128* %clobberdst, align 1
+; X32-FASTMOVBE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
;
%a = load i128, i128* %src, align 1
%bswap = call i128 @llvm.bswap.i128(i128 %a)