Chromium Code Reviews

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: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 853 matching lines...)
864 m.Return(n); 864 m.Return(n);
865 Stream s = m.Build(); 865 Stream s = m.Build();
866 ASSERT_EQ(1U, s.size()); 866 ASSERT_EQ(1U, s.size());
867 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode()); 867 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode());
868 ASSERT_EQ(1U, s[0]->InputCount()); 868 ASSERT_EQ(1U, s[0]->InputCount());
869 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 869 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
870 ASSERT_EQ(1U, s[0]->OutputCount()); 870 ASSERT_EQ(1U, s[0]->OutputCount());
871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
872 } 872 }
873 873
874
875 TEST_F(InstructionSelectorTest, Float32Max) {
876 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
877 Node* const p0 = m.Parameter(0);
878 Node* const p1 = m.Parameter(1);
879 Node* const n = m.Float32Max(p0, p1);
880 m.Return(n);
881 Stream s = m.Build();
882 // Float32Max is `(b < a) ? a : b`.
883 ASSERT_EQ(1U, s.size());
884 EXPECT_EQ(kMips64Float32Max, s[0]->arch_opcode());
885 ASSERT_EQ(2U, s[0]->InputCount());
886 ASSERT_EQ(1U, s[0]->OutputCount());
887 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
888 }
889
890
891 TEST_F(InstructionSelectorTest, Float32Min) {
892 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
893 Node* const p0 = m.Parameter(0);
894 Node* const p1 = m.Parameter(1);
895 Node* const n = m.Float32Min(p0, p1);
896 m.Return(n);
897 Stream s = m.Build();
898 // Float32Min is `(a < b) ? a : b`.
899 ASSERT_EQ(1U, s.size());
900 EXPECT_EQ(kMips64Float32Min, s[0]->arch_opcode());
901 ASSERT_EQ(2U, s[0]->InputCount());
902 ASSERT_EQ(1U, s[0]->OutputCount());
903 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
904 }
905
906
907 TEST_F(InstructionSelectorTest, Float64Max) {
908 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
909 Node* const p0 = m.Parameter(0);
910 Node* const p1 = m.Parameter(1);
911 Node* const n = m.Float64Max(p0, p1);
912 m.Return(n);
913 Stream s = m.Build();
914 // Float64Max is `(b < a) ? a : b`.
915 ASSERT_EQ(1U, s.size());
916 EXPECT_EQ(kMips64Float64Max, s[0]->arch_opcode());
917 ASSERT_EQ(2U, s[0]->InputCount());
918 ASSERT_EQ(1U, s[0]->OutputCount());
919 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
920 }
921
922
923 TEST_F(InstructionSelectorTest, Float64Min) {
924 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
925 Node* const p0 = m.Parameter(0);
926 Node* const p1 = m.Parameter(1);
927 Node* const n = m.Float64Min(p0, p1);
928 m.Return(n);
929 Stream s = m.Build();
930 // Float64Min is `(a < b) ? a : b`.
931 ASSERT_EQ(1U, s.size());
932 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode());
933 ASSERT_EQ(2U, s[0]->InputCount());
934 ASSERT_EQ(1U, s[0]->OutputCount());
935 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
936 }
937
874 } // namespace compiler 938 } // namespace compiler
875 } // namespace internal 939 } // namespace internal
876 } // namespace v8 940 } // namespace v8
OLDNEW

Powered by Google App Engine