[PATCH] D32706: [AArch64] Consider lengthening instructions in cast cost calculation
Kristof Beyls via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 00:31:16 PDT 2017
kristof.beyls added inline comments.
================
Comment at: lib/Target/AArch64/AArch64TargetTransformInfo.cpp:195-196
+ //
+ // TODO: Add additional lengthening operations (e.g., mul, shl, etc.) once we
+ // verify that the extends are eliminated during code generation.
+ auto *SingleUser = cast<Instruction>(*I->user_begin());
----------------
If the idea is that this function only return true if the lengthening/widening is zero-cost; maybe the function name should be isLengtheningFree instead of isLengthening?
Or something similar indicating the expected cost of widening is zero?
================
Comment at: lib/Target/AArch64/AArch64TargetTransformInfo.h:46-47
+ bool isLengthening(Type *Dst, Type *Src, const Instruction *I);
+
public:
----------------
I think the term "widening" is used for this operation, both in the LLVM code base, as well as in the ARMARM.
So, probably best to use isWidening here too.
================
Comment at: test/Analysis/CostModel/AArch64/lengthening-casts.ll:1-14
+; RUN: opt < %s -cost-model -analyze | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64--linux-gnu"
+
+; CHECK-LABEL: uaddl_8h
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %tmp0 = zext <8 x i8> %a to <8 x i16>
----------------
Next to tests that verify that a 0 cost is returned, maybe it'd also be useful to explicitly test that the widening instruction variant actually gets generated?
https://reviews.llvm.org/D32706
More information about the llvm-commits
mailing list