gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
32using namespace gem5;
33
34TEST(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
57TEST(Aapcs64, IsAapcs64Hfa)
58{
59 // Accept floating point arrays with up to 4 members.
60 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<float[1]>);
61 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<float[2]>);
62 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<float[3]>);
63 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<float[4]>);
64
65 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<double[1]>);
66 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<double[2]>);
67 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<double[3]>);
68 EXPECT_TRUE(guest_abi::IsAapcs64HfaV<double[4]>);
69
70 // Too many members.
71 EXPECT_FALSE(guest_abi::IsAapcs64HfaV<float[5]>);
72 EXPECT_FALSE(guest_abi::IsAapcs64HfaV<double[5]>);
73
74 // Wrong type of members, or not arrays.
75 EXPECT_FALSE(guest_abi::IsAapcs64HfaV<int32_t[3]>);
77 struct Struct {};
80}
81
82TEST(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::IsAapcs64HvaV<SvaInt[3]>);
89 EXPECT_TRUE(guest_abi::IsAapcs64HvaV<SvaInt[4]>);
90 EXPECT_FALSE(guest_abi::IsAapcs64HvaV<SvaInt[5]>);
91
92 EXPECT_TRUE(guest_abi::IsAapcs64HvaV<SvaFloat[3]>);
93 EXPECT_TRUE(guest_abi::IsAapcs64HvaV<SvaFloat[4]>);
94 EXPECT_FALSE(guest_abi::IsAapcs64HvaV<SvaFloat[5]>);
95
96 EXPECT_TRUE(guest_abi::IsAapcs64HvaV<SvaTiny[3]>);
97 EXPECT_TRUE(guest_abi::IsAapcs64HvaV<SvaTiny[4]>);
98 EXPECT_FALSE(guest_abi::IsAapcs64HvaV<SvaTiny[5]>);
99
101 EXPECT_FALSE(guest_abi::IsAapcs64HvaV<uint64_t[1]>);
103 EXPECT_FALSE(guest_abi::IsAapcs64HvaV<void>);
105}
106
107TEST(Aapcs64, IsAapcs64Hxa)
108{
109 using SvaInt = uint32_t[2];
110
111 EXPECT_TRUE(guest_abi::IsAapcs64HxaV<SvaInt[4]>);
112 EXPECT_FALSE(guest_abi::IsAapcs64HxaV<SvaInt[5]>);
113
114 EXPECT_TRUE(guest_abi::IsAapcs64HxaV<float[4]>);
115 EXPECT_FALSE(guest_abi::IsAapcs64HxaV<float[5]>);
116
119 EXPECT_FALSE(guest_abi::IsAapcs64HxaV<void>);
120}
TEST(Aapcs64, IsAapcs64ShortVector)
This is a simple scalar statistic, like a counter.
constexpr bool IsAapcs64HvaV
Definition aapcs64.hh:150
constexpr bool IsAapcs64HfaV
Definition aapcs64.hh:134
constexpr bool IsAapcs64HxaV
Definition aapcs64.hh:163
constexpr bool IsAapcs64ShortVectorV
Definition aapcs64.hh:93
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36

Generated on Tue Jun 18 2024 16:23:55 for gem5 by doxygen 1.11.0