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

Side by Side Diff: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc

Issue 2170343002: [turbofan] Change Float64Max/Float64Min to JavaScript semantics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips/mips64 ports. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 Stream s = m.Build(); 4144 Stream s = m.Build();
4145 ASSERT_EQ(1U, s.size()); 4145 ASSERT_EQ(1U, s.size());
4146 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); 4146 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
4147 ASSERT_EQ(1U, s[0]->InputCount()); 4147 ASSERT_EQ(1U, s[0]->InputCount());
4148 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 4148 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4149 ASSERT_EQ(1U, s[0]->OutputCount()); 4149 ASSERT_EQ(1U, s[0]->OutputCount());
4150 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 4150 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4151 } 4151 }
4152 4152
4153 4153
4154 TEST_F(InstructionSelectorTest, Float32Max) {
4155 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
4156 MachineType::Float32());
4157 Node* const p0 = m.Parameter(0);
4158 Node* const p1 = m.Parameter(1);
4159 Node* const n = m.Float32Max(p0, p1);
4160 m.Return(n);
4161 Stream s = m.Build();
4162 // Float32Max is `(b < a) ? a : b`.
4163 ASSERT_EQ(1U, s.size());
4164 EXPECT_EQ(kArm64Float32Max, s[0]->arch_opcode());
4165 ASSERT_EQ(2U, s[0]->InputCount());
4166 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4167 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
4168 ASSERT_EQ(1U, s[0]->OutputCount());
4169 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4170 }
4171
4172
4173 TEST_F(InstructionSelectorTest, Float32Min) {
4174 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
4175 MachineType::Float32());
4176 Node* const p0 = m.Parameter(0);
4177 Node* const p1 = m.Parameter(1);
4178 Node* const n = m.Float32Min(p0, p1);
4179 m.Return(n);
4180 Stream s = m.Build();
4181 // Float32Min is `(a < b) ? a : b`.
4182 ASSERT_EQ(1U, s.size());
4183 EXPECT_EQ(kArm64Float32Min, s[0]->arch_opcode());
4184 ASSERT_EQ(2U, s[0]->InputCount());
4185 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4186 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
4187 ASSERT_EQ(1U, s[0]->OutputCount());
4188 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4189 }
4190
4191
4192 TEST_F(InstructionSelectorTest, Float64Max) { 4154 TEST_F(InstructionSelectorTest, Float64Max) {
4193 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), 4155 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
4194 MachineType::Float64()); 4156 MachineType::Float64());
4195 Node* const p0 = m.Parameter(0); 4157 Node* const p0 = m.Parameter(0);
4196 Node* const p1 = m.Parameter(1); 4158 Node* const p1 = m.Parameter(1);
4197 Node* const n = m.Float64Max(p0, p1); 4159 Node* const n = m.Float64Max(p0, p1);
4198 m.Return(n); 4160 m.Return(n);
4199 Stream s = m.Build(); 4161 Stream s = m.Build();
4200 // Float64Max is `(b < a) ? a : b`.
4201 ASSERT_EQ(1U, s.size()); 4162 ASSERT_EQ(1U, s.size());
4202 EXPECT_EQ(kArm64Float64Max, s[0]->arch_opcode()); 4163 EXPECT_EQ(kArm64Float64Max, s[0]->arch_opcode());
4203 ASSERT_EQ(2U, s[0]->InputCount()); 4164 ASSERT_EQ(2U, s[0]->InputCount());
4204 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 4165 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4205 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); 4166 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
4206 ASSERT_EQ(1U, s[0]->OutputCount()); 4167 ASSERT_EQ(1U, s[0]->OutputCount());
4207 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 4168 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4208 } 4169 }
4209 4170
4210 4171
4211 TEST_F(InstructionSelectorTest, Float64Min) { 4172 TEST_F(InstructionSelectorTest, Float64Min) {
4212 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), 4173 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
4213 MachineType::Float64()); 4174 MachineType::Float64());
4214 Node* const p0 = m.Parameter(0); 4175 Node* const p0 = m.Parameter(0);
4215 Node* const p1 = m.Parameter(1); 4176 Node* const p1 = m.Parameter(1);
4216 Node* const n = m.Float64Min(p0, p1); 4177 Node* const n = m.Float64Min(p0, p1);
4217 m.Return(n); 4178 m.Return(n);
4218 Stream s = m.Build(); 4179 Stream s = m.Build();
4219 // Float64Min is `(a < b) ? a : b`.
4220 ASSERT_EQ(1U, s.size()); 4180 ASSERT_EQ(1U, s.size());
4221 EXPECT_EQ(kArm64Float64Min, s[0]->arch_opcode()); 4181 EXPECT_EQ(kArm64Float64Min, s[0]->arch_opcode());
4222 ASSERT_EQ(2U, s[0]->InputCount()); 4182 ASSERT_EQ(2U, s[0]->InputCount());
4223 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 4183 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4224 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); 4184 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
4225 ASSERT_EQ(1U, s[0]->OutputCount()); 4185 ASSERT_EQ(1U, s[0]->OutputCount());
4226 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 4186 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4227 } 4187 }
4228 4188
4229 TEST_F(InstructionSelectorTest, Float32Neg) { 4189 TEST_F(InstructionSelectorTest, Float32Neg) {
(...skipping 22 matching lines...) Expand all
4252 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); 4212 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
4253 ASSERT_EQ(1U, s[0]->InputCount()); 4213 ASSERT_EQ(1U, s[0]->InputCount());
4254 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 4214 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
4255 ASSERT_EQ(1U, s[0]->OutputCount()); 4215 ASSERT_EQ(1U, s[0]->OutputCount());
4256 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 4216 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
4257 } 4217 }
4258 4218
4259 } // namespace compiler 4219 } // namespace compiler
4260 } // namespace internal 4220 } // namespace internal
4261 } // namespace v8 4221 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698