craig.topper added inline comments.
================ Comment at: include/clang/Basic/BuiltinsWebAssembly.def:46 +BUILTIN(__builtin_wasm_extract_lane_s_i16x8, "iV8sIi", "ncV:128:") +BUILTIN(__builtin_wasm_extract_lane_u_i16x8, "iV8sIi", "ncV:128:") +BUILTIN(__builtin_wasm_extract_lane_i32x4, "iV4iIi", "ncV:128:") ---------------- aheejin wrote: > - I guess the return types should be the same as its element type, because we > are translating to not wasm but LLVM IR instructions and `extractelement`'s > return type and element type are the same. > - What does `I` mean in the second argument? The instruction says it is > required for constant folding. How is the generated IR different if we use it? The I makes Sema ensure it is a Integer Constant Expression. ================ Comment at: lib/CodeGen/CGBuiltin.cpp:12433 + Value *Vec = EmitScalarExpr(E->getArg(0)); + Value *Lane = EmitScalarExpr(E->getArg(1)); + Value *Extract = Builder.CreateExtractElement(Vec, Lane); ---------------- I believe you need to use isIntegerConstantExpr to force clang to really evaluate it as a constant integer. if its a more complicated expression. Repository: rC Clang https://reviews.llvm.org/D52852 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits