File: vbits.h

package info (click to toggle)
valgrind 1%3A3.24.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 176,332 kB
  • sloc: ansic: 795,029; exp: 26,134; xml: 23,472; asm: 14,393; cpp: 9,397; makefile: 7,464; sh: 6,122; perl: 5,446; python: 1,498; javascript: 981; awk: 166; csh: 1
file content (103 lines) | stat: -rw-r--r-- 3,774 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* -*- mode: C; c-basic-offset: 3; -*- */

/*
   This file is part of MemCheck, a heavyweight Valgrind tool for
   detecting memory errors.

   Copyright (C) 2012-2017  Florian Krohm

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, see <http://www.gnu.org/licenses/>.

   The GNU General Public License is contained in the file COPYING.
*/

#ifndef VBITS_H
#define VBITS_H

#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>

typedef uint64_t uint128_t[2];
typedef uint64_t uint256_t[4];

/* A type to represent V-bits */
typedef struct {
   unsigned num_bits;
   union {
      uint8_t   u8;
      uint16_t  u16;
      uint32_t  u32;
      uint64_t  u64;
      uint128_t u128;
      uint256_t u256;
   } bits;
} vbits_t;


/* A type large enough to hold any IRType'd value. At this point
   we do not expect to test with specific floating point values.
   So we don't need to represent them. */
typedef union {
   uint8_t   u8;
   uint16_t  u16;
   uint32_t  u32;
   uint64_t  u64;
   uint128_t u128;
   uint256_t u256;
} value_t;


void    print_vbits(FILE *, vbits_t);
vbits_t undefined_vbits(unsigned num_bits);
vbits_t undefined_vbits_BxE(unsigned int bits, unsigned int elements,
                            vbits_t v);
vbits_t undefined_vbits_BxE_rotate(unsigned int bits, unsigned int elements,
                                   vbits_t vbits,
                                   value_t value);
vbits_t undefined_vbits_128_even_element(unsigned int bits,
                                         unsigned int elements, vbits_t v);
vbits_t undefined_vbits_64x2_transpose(vbits_t v);
vbits_t undefined_vbits_Narrow256_AtoB(unsigned int src_num_bits,
                                       unsigned int result_num_bits,
                                       vbits_t src1_v, value_t src1_value,
                                       vbits_t src2_v, value_t src2_value,
                                       bool sataurate);
vbits_t defined_vbits(unsigned num_bits);
int     equal_vbits(vbits_t, vbits_t);
vbits_t truncate_vbits(vbits_t, unsigned num_bits);
vbits_t left_vbits(vbits_t, unsigned num_bits);
vbits_t or_vbits(vbits_t, vbits_t);
vbits_t and_vbits(vbits_t, vbits_t);
vbits_t concat_vbits(vbits_t, vbits_t);
vbits_t upper_vbits(vbits_t);
vbits_t sextend_vbits(vbits_t, unsigned num_bits);
vbits_t zextend_vbits(vbits_t, unsigned num_bits);
vbits_t onehot_vbits(unsigned bitno, unsigned num_bits);
vbits_t shl_vbits(vbits_t, unsigned amount);
vbits_t shr_vbits(vbits_t, unsigned amount);
vbits_t sar_vbits(vbits_t, unsigned amount);
int     completely_defined_vbits(vbits_t);
vbits_t cmpord_vbits(unsigned v1_num_bits, unsigned v2_num_bits);
vbits_t cmp_eq_ne_vbits(vbits_t vbits1, vbits_t vbits2,
                        value_t val1, value_t val2);
uint64_t min_vbits(uint64_t vbits, uint64_t value);
uint64_t max_vbits(uint64_t vbits, uint64_t value);
vbits_t int_add_or_sub_vbits(int isAdd,
                             vbits_t vbits1, vbits_t vbits2,
                             value_t val1, value_t val2);
vbits_t cmp_gt_vbits(int is_signed, int bits_per_element, int element_count,
                     vbits_t vbits1, vbits_t vbits2, value_t val1, value_t val2);

#endif // VBITS_H