Index: test/cctest/compiler/test-simplified-lowering.cc |
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc |
index 163fdc8fb731feb488ed490f817d31ddf9d82935..2c97379cbb0cd8eb1a85c6ae311feb6c8e9e8e22 100644 |
--- a/test/cctest/compiler/test-simplified-lowering.cc |
+++ b/test/cctest/compiler/test-simplified-lowering.cc |
@@ -1510,3 +1510,38 @@ TEST(UpdatePhi) { |
RepresentationOf(OpParameter<MachineType>(phi))); |
} |
} |
+ |
+ |
+// TODO(titzer): this tests current behavior of assuming an implicit |
+// representation change in loading float32s. Fix when float32 is fully |
+// supported. |
+TEST(ImplicitFloat32ToFloat64InLoads) { |
+ TestingGraph t(Type::Any()); |
+ |
+ FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
+ Handle<Name>::null(), Type::Any(), kMachFloat32}; |
+ |
+ Node* load = |
+ t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start); |
+ t.Return(load); |
+ t.Lower(); |
+ CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
+ CHECK_EQ(t.p0, load->InputAt(0)); |
+ CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
+} |
+ |
+ |
+TEST(ImplicitFloat64ToFloat32InStores) { |
+ TestingGraph t(Type::Any(), Type::Signed32()); |
+ FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
+ Handle<Name>::null(), Type::Any(), kMachFloat32}; |
+ |
+ Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
+ t.p1, t.start, t.start); |
+ t.Effect(store); |
+ t.Lower(); |
+ |
+ CHECK_EQ(IrOpcode::kStore, store->opcode()); |
+ CHECK_EQ(t.p0, store->InputAt(0)); |
+ CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
+} |