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

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

Issue 1419753008: MIPS: [turbofan] Properly implement Float64/32 Min/Max instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove redundant functions. Created 5 years, 1 month 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
« no previous file with comments | « test/unittests/compiler/mips/instruction-selector-mips-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 m.Return(n); 863 m.Return(n);
864 Stream s = m.Build(); 864 Stream s = m.Build();
865 ASSERT_EQ(1U, s.size()); 865 ASSERT_EQ(1U, s.size());
866 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode()); 866 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode());
867 ASSERT_EQ(1U, s[0]->InputCount()); 867 ASSERT_EQ(1U, s[0]->InputCount());
868 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 868 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
869 ASSERT_EQ(1U, s[0]->OutputCount()); 869 ASSERT_EQ(1U, s[0]->OutputCount());
870 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 870 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
871 } 871 }
872 872
873
874 TEST_F(InstructionSelectorTest, Float32Max) {
875 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
876 Node* const p0 = m.Parameter(0);
877 Node* const p1 = m.Parameter(1);
878 Node* const n = m.Float32Max(p0, p1);
879 m.Return(n);
880 Stream s = m.Build();
881 // Float32Max is `(b < a) ? a : b`.
882 ASSERT_EQ(1U, s.size());
883 EXPECT_EQ(kMips64Float32Max, s[0]->arch_opcode());
884 ASSERT_EQ(2U, s[0]->InputCount());
885 ASSERT_EQ(1U, s[0]->OutputCount());
886 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
887 }
888
889
890 TEST_F(InstructionSelectorTest, Float32Min) {
891 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
892 Node* const p0 = m.Parameter(0);
893 Node* const p1 = m.Parameter(1);
894 Node* const n = m.Float32Min(p0, p1);
895 m.Return(n);
896 Stream s = m.Build();
897 // Float32Min is `(a < b) ? a : b`.
898 ASSERT_EQ(1U, s.size());
899 EXPECT_EQ(kMips64Float32Min, s[0]->arch_opcode());
900 ASSERT_EQ(2U, s[0]->InputCount());
901 ASSERT_EQ(1U, s[0]->OutputCount());
902 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
903 }
904
905
906 TEST_F(InstructionSelectorTest, Float64Max) {
907 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
908 Node* const p0 = m.Parameter(0);
909 Node* const p1 = m.Parameter(1);
910 Node* const n = m.Float64Max(p0, p1);
911 m.Return(n);
912 Stream s = m.Build();
913 // Float64Max is `(b < a) ? a : b`.
914 ASSERT_EQ(1U, s.size());
915 EXPECT_EQ(kMips64Float64Max, s[0]->arch_opcode());
916 ASSERT_EQ(2U, s[0]->InputCount());
917 ASSERT_EQ(1U, s[0]->OutputCount());
918 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
919 }
920
921
922 TEST_F(InstructionSelectorTest, Float64Min) {
923 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
924 Node* const p0 = m.Parameter(0);
925 Node* const p1 = m.Parameter(1);
926 Node* const n = m.Float64Min(p0, p1);
927 m.Return(n);
928 Stream s = m.Build();
929 // Float64Min is `(a < b) ? a : b`.
930 ASSERT_EQ(1U, s.size());
931 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode());
932 ASSERT_EQ(2U, s[0]->InputCount());
933 ASSERT_EQ(1U, s[0]->OutputCount());
934 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
935 }
936
873 } // namespace compiler 937 } // namespace compiler
874 } // namespace internal 938 } // namespace internal
875 } // namespace v8 939 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/mips/instruction-selector-mips-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698