[PATCH] D44786: Lowering x86 adds/addus/subs/subus intrinsics (clang)

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 23:02:43 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7897
+  Value *MaxVec = CGF.Builder.CreateVectorSplat(NumElements, Max);
+  Value *ExtMaxVec = Signed ? CGF.Builder.CreateSExt(MaxVec, ExtType)
+                            : CGF.Builder.CreateZExt(MaxVec, ExtType);
----------------
Can we just create the constant in the extended type?


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7910
+        llvm::APInt::getSignedMinValue(ElementType->getPrimitiveSizeInBits());
+    Value *Min = llvm::ConstantInt::get(ElementType, SignedMinValue);
+    Value *MinVec = CGF.Builder.CreateVectorSplat(NumElements, Min);
----------------
ConstantInt::get should be able to splat on its own if you give it a vector type. Same with getAllOnesValue above


================
Comment at: lib/CodeGen/CGBuiltin.cpp:8922
+  case X86::BI__builtin_ia32_psubusw128:
+    return EmitX86AddSubSatExpr(*this, E, Ops, false, false); // Substraction, unsigned.
+  case X86::BI__builtin_ia32_psubsb512_mask:
----------------
Substraction->Subtraction


================
Comment at: lib/CodeGen/CGBuiltin.cpp:8929
+  case X86::BI__builtin_ia32_psubsw128:
+    return EmitX86AddSubSatExpr(*this, E, Ops, false, true); // Substraction, signed.
   }
----------------
Substraction->Subtraction


Repository:
  rC Clang

https://reviews.llvm.org/D44786





More information about the cfe-commits mailing list