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

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

Issue 1862993002: [arm] Implement Float(32|64)(Min|Max) using vsel. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « test/cctest/test-disasm-arm.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 <limits> 5 #include <limits>
6 6
7 #include "test/unittests/compiler/instruction-selector-unittest.h" 7 #include "test/unittests/compiler/instruction-selector-unittest.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 m.Return(n); 2947 m.Return(n);
2948 Stream s = m.Build(); 2948 Stream s = m.Build();
2949 ASSERT_EQ(1U, s.size()); 2949 ASSERT_EQ(1U, s.size());
2950 EXPECT_EQ(kArmClz, s[0]->arch_opcode()); 2950 EXPECT_EQ(kArmClz, s[0]->arch_opcode());
2951 ASSERT_EQ(1U, s[0]->InputCount()); 2951 ASSERT_EQ(1U, s[0]->InputCount());
2952 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 2952 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2953 ASSERT_EQ(1U, s[0]->OutputCount()); 2953 ASSERT_EQ(1U, s[0]->OutputCount());
2954 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 2954 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
2955 } 2955 }
2956 2956
2957 TEST_F(InstructionSelectorTest, Float32Max) {
2958 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
2959 MachineType::Float32());
2960 Node* const p0 = m.Parameter(0);
2961 Node* const p1 = m.Parameter(1);
2962 Node* const n = m.Float32Max(p0, p1);
2963 m.Return(n);
2964 Stream s = m.Build(ARMv8);
2965 // Float32Max is `(b < a) ? a : b`.
2966 ASSERT_EQ(1U, s.size());
2967 EXPECT_EQ(kArmFloat32Max, s[0]->arch_opcode());
2968 ASSERT_EQ(2U, s[0]->InputCount());
2969 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2970 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
2971 ASSERT_EQ(1U, s[0]->OutputCount());
2972 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
2973 }
2974
2975 TEST_F(InstructionSelectorTest, Float32Min) {
2976 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
2977 MachineType::Float32());
2978 Node* const p0 = m.Parameter(0);
2979 Node* const p1 = m.Parameter(1);
2980 Node* const n = m.Float32Min(p0, p1);
2981 m.Return(n);
2982 Stream s = m.Build(ARMv8);
2983 // Float32Min is `(a < b) ? a : b`.
2984 ASSERT_EQ(1U, s.size());
2985 EXPECT_EQ(kArmFloat32Min, s[0]->arch_opcode());
2986 ASSERT_EQ(2U, s[0]->InputCount());
2987 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2988 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
2989 ASSERT_EQ(1U, s[0]->OutputCount());
2990 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
2991 }
2992
2993 TEST_F(InstructionSelectorTest, Float64Max) {
2994 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
2995 MachineType::Float64());
2996 Node* const p0 = m.Parameter(0);
2997 Node* const p1 = m.Parameter(1);
2998 Node* const n = m.Float64Max(p0, p1);
2999 m.Return(n);
3000 Stream s = m.Build(ARMv8);
3001 // Float64Max is `(b < a) ? a : b`.
3002 ASSERT_EQ(1U, s.size());
3003 EXPECT_EQ(kArmFloat64Max, s[0]->arch_opcode());
3004 ASSERT_EQ(2U, s[0]->InputCount());
3005 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
3006 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
3007 ASSERT_EQ(1U, s[0]->OutputCount());
3008 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
3009 }
3010
3011 TEST_F(InstructionSelectorTest, Float64Min) {
3012 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
3013 MachineType::Float64());
3014 Node* const p0 = m.Parameter(0);
3015 Node* const p1 = m.Parameter(1);
3016 Node* const n = m.Float64Min(p0, p1);
3017 m.Return(n);
3018 Stream s = m.Build(ARMv8);
3019 // Float64Min is `(a < b) ? a : b`.
3020 ASSERT_EQ(1U, s.size());
3021 EXPECT_EQ(kArmFloat64Min, s[0]->arch_opcode());
3022 ASSERT_EQ(2U, s[0]->InputCount());
3023 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
3024 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
3025 ASSERT_EQ(1U, s[0]->OutputCount());
3026 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
3027 }
3028
2957 } // namespace compiler 3029 } // namespace compiler
2958 } // namespace internal 3030 } // namespace internal
2959 } // namespace v8 3031 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698