[PATCH] D99439: Update @llvm.powi to handle different int sizes for the exponent

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 07:54:25 PDT 2021


fhahn added a comment.

Probably would be good to split this up in separate LLVM/Clang parts. Do we need to auto-upgrade calls to `llvm.powi`?



================
Comment at: llvm/docs/LangRef.rst:13280
+floating-point or vector of floating-point type. The type of the exponent
+should typically match the size of ``int``, at least when the intrinsic maps
+to one of the ``__powi*`` functions in compiler-rt. Not all targets support
----------------
Not sure about the sentence about the size of the exponent. It refers to `int` and `__powi`, both of which are not really defined in the LangRef and it is not clear to what they are referring to here.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:573
   unsigned Offset = IsStrict ? 1 : 0;
-  assert(N->getOperand(1 + Offset).getValueType() == MVT::i32 &&
+  assert((N->getOperand(1 + Offset).getValueType() == MVT::i16 ||
+          N->getOperand(1 + Offset).getValueType() == MVT::i32) &&
----------------
Why just allow i32 and i16 here?

Could we restrict the supported offset types to i32 or smaller?


================
Comment at: llvm/test/Transforms/InstCombine/pow_fp_int16.ll:1
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -mtriple unknown -instcombine -S < %s | FileCheck %s
+; RUN: opt -mtriple msp430 -instcombine -S < %s | FileCheck %s
 
----------------
I don't think we can rely on any specific triple here. If a triple is needed it should be in a sub-directory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99439/new/

https://reviews.llvm.org/D99439



More information about the llvm-commits mailing list