gem5  v21.1.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
aapcs64.test.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <gtest/gtest.h>
29 
30 #include "arch/arm/aapcs64.hh"
31 
32 using namespace gem5;
33 
34 TEST(Aapcs64, IsAapcs64ShortVector)
35 {
36  using Scalar = uint64_t;
37  using TooShort = uint8_t[2];
38  using TooLong = uint16_t[32];
39  using TooLongFloat = double[4];
40  using EightLong = uint32_t[2];
41  using SixteenLong = uint64_t[2];
42  using EightLongFloat = float[2];
43  using SixteenLongFloat = double[2];
44 
50 
55 }
56 
57 TEST(Aapcs64, IsAapcs64Hfa)
58 {
59  // Accept floating point arrays with up to 4 members.
60  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<float[1]>::value);
61  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<float[2]>::value);
62  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<float[3]>::value);
63  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<float[4]>::value);
64 
65  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<double[1]>::value);
66  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<double[2]>::value);
67  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<double[3]>::value);
68  EXPECT_TRUE(guest_abi::IsAapcs64Hfa<double[4]>::value);
69 
70  // Too many members.
71  EXPECT_FALSE(guest_abi::IsAapcs64Hfa<float[5]>::value);
72  EXPECT_FALSE(guest_abi::IsAapcs64Hfa<double[5]>::value);
73 
74  // Wrong type of members, or not arrays.
75  EXPECT_FALSE(guest_abi::IsAapcs64Hfa<int32_t[3]>::value);
77  struct Struct {};
80 }
81 
82 TEST(Aapcs64, IsAapcs64Hva)
83 {
84  using SvaInt = uint32_t[2];
85  using SvaTiny = uint8_t[16];
86  using SvaFloat = float[2];
87 
88  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaInt[3]>::value);
89  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaInt[4]>::value);
90  EXPECT_FALSE(guest_abi::IsAapcs64Hva<SvaInt[5]>::value);
91 
92  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaFloat[3]>::value);
93  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaFloat[4]>::value);
94  EXPECT_FALSE(guest_abi::IsAapcs64Hva<SvaFloat[5]>::value);
95 
96  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaTiny[3]>::value);
97  EXPECT_TRUE(guest_abi::IsAapcs64Hva<SvaTiny[4]>::value);
98  EXPECT_FALSE(guest_abi::IsAapcs64Hva<SvaTiny[5]>::value);
99 
100  EXPECT_FALSE(guest_abi::IsAapcs64Hva<uint64_t>::value);
101  EXPECT_FALSE(guest_abi::IsAapcs64Hva<uint64_t[1]>::value);
102  EXPECT_FALSE(guest_abi::IsAapcs64Hva<SvaTiny>::value);
103  EXPECT_FALSE(guest_abi::IsAapcs64Hva<void>::value);
104  EXPECT_FALSE(guest_abi::IsAapcs64Hva<float>::value);
105 }
106 
107 TEST(Aapcs64, IsAapcs64Hxa)
108 {
109  using SvaInt = uint32_t[2];
110 
111  EXPECT_TRUE(guest_abi::IsAapcs64Hxa<SvaInt[4]>::value);
112  EXPECT_FALSE(guest_abi::IsAapcs64Hxa<SvaInt[5]>::value);
113 
114  EXPECT_TRUE(guest_abi::IsAapcs64Hxa<float[4]>::value);
115  EXPECT_FALSE(guest_abi::IsAapcs64Hxa<float[5]>::value);
116 
117  EXPECT_FALSE(guest_abi::IsAapcs64Hxa<SvaInt>::value);
118  EXPECT_FALSE(guest_abi::IsAapcs64Hxa<uint64_t>::value);
119  EXPECT_FALSE(guest_abi::IsAapcs64Hxa<void>::value);
120 }
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
TEST
TEST(Aapcs64, IsAapcs64ShortVector)
Definition: aapcs64.test.cc:34
aapcs64.hh
gem5::Aapcs64
Definition: aapcs64.hh:48
gem5::guest_abi::IsAapcs64Hfa
Definition: aapcs64.hh:121
gem5::guest_abi::IsAapcs64ShortVector
Definition: aapcs64.hh:82
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40

Generated on Tue Sep 21 2021 12:24:21 for gem5 by doxygen 1.8.17