Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: src/compiler/change-lowering.cc

Issue 1693563004: Convert between tagged and untagged kSimd128 values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc b/src/compiler/change-lowering.cc
index 907b36a93b7dd860c2a32e27a6b685444c9baf33..6bee8aba74626b3e372f979af7c2f6d242b091e9 100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -39,6 +39,13 @@ Reduction ChangeLowering::Reduce(Node* node) {
return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
case IrOpcode::kChangeUint32ToTagged:
return ChangeUint32ToTagged(node->InputAt(0), control);
+#define SIMD128_CASES(TYPE, Type, type, lane_count, lane_type) \
+ case IrOpcode::kChange##Type##ToTagged: \
+ return Change##Type##ToTagged(node->InputAt(0), control); \
+ case IrOpcode::kChangeTaggedTo##Type: \
+ return ChangeTaggedTo##Type(node->InputAt(0), control);
+ SIMD128_TYPES(SIMD128_CASES)
+#undef SIMD128_CASES
case IrOpcode::kLoadField:
return LoadField(node);
case IrOpcode::kStoreField:
@@ -69,6 +76,9 @@ Node* ChangeLowering::HeapNumberValueIndexConstant() {
return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag);
}
+Node* ChangeLowering::Simd128ValueIndexConstant() {
+ return jsgraph()->IntPtrConstant(Simd128Value::kValueOffset - kHeapObjectTag);
+}
Node* ChangeLowering::SmiMaxValueConstant() {
return jsgraph()->Int32Constant(Smi::kMaxValue);
@@ -102,6 +112,29 @@ Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) {
return graph()->NewNode(common()->FinishRegion(), heap_number, store);
}
+#define SIMD128_ALLOCATE(TYPE, Type, type, lane_count, lane_type) \
+ Node* ChangeLowering::Allocate##Type##WithValue(Node* value) { \
+ Callable callable = CodeFactory::Allocate##Type(isolate()); \
+ Node* target = jsgraph()->HeapConstant(callable.code()); \
+ Node* context = jsgraph()->NoContextConstant(); \
+ Node* effect = \
+ graph()->NewNode(common()->BeginRegion(), graph()->start()); \
+ if (!allocate_##type##_value_operator_.is_set()) { \
+ CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( \
+ isolate(), jsgraph()->zone(), callable.descriptor(), 0, \
+ CallDescriptor::kNoFlags, Operator::kNoThrow); \
+ allocate_##type##_value_operator_.set(common()->Call(descriptor)); \
+ } \
+ Node* simd_value = graph()->NewNode( \
+ allocate_##type##_value_operator_.get(), target, context, effect); \
+ Node* store = graph()->NewNode( \
+ machine()->Store(StoreRepresentation(MachineRepresentation::kSimd128, \
+ kNoWriteBarrier)), \
+ simd_value, Simd128ValueIndexConstant(), value, simd_value); \
+ return graph()->NewNode(common()->FinishRegion(), simd_value, store); \
+ }
+SIMD128_TYPES(SIMD128_ALLOCATE)
+#undef SIMD128_ALLOCATE
Node* ChangeLowering::ChangeInt32ToFloat64(Node* value) {
return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value);
@@ -149,6 +182,13 @@ Node* ChangeLowering::LoadHeapNumberValue(Node* value, Node* control) {
control);
}
+#define SIMD128_LOAD(TYPE, Type, type, lane_count, lane_type) \
+ Node* ChangeLowering::Load##Type##Value(Node* value) { \
+ return graph()->NewNode(machine()->Load(MachineType::Simd128()), value, \
+ Simd128ValueIndexConstant(), graph()->start()); \
+ }
+SIMD128_TYPES(SIMD128_LOAD)
+#undef SIMD128_LOAD
Node* ChangeLowering::TestNotSmi(Node* value) {
STATIC_ASSERT(kSmiTag == 0);
@@ -427,6 +467,20 @@ Reduction ChangeLowering::ChangeUint32ToTagged(Node* value, Node* control) {
return Replace(phi);
}
+#define SIMD128_CHANGE(TYPE, SType, type, lane_count, lane_type) \
+ Reduction ChangeLowering::ChangeTaggedTo##SType(Node* value, \
+ Node* control) { \
+ DCHECK(NodeProperties::GetType(value)->Is(Type::TaggedPointer())); \
+ return Replace(Load##SType##Value(value)); \
+ } \
+ \
+ Reduction ChangeLowering::Change##SType##ToTagged(Node* value, \
+ Node* control) { \
+ DCHECK(NodeProperties::GetType(value)->Is(Type::Simd())); \
+ return Replace(Allocate##SType##WithValue(value)); \
+ }
+SIMD128_TYPES(SIMD128_CHANGE)
+#undef SIMD128_CHANGE
namespace {
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698