Jlm
Macros | Functions | Variables
BitstringTests.cpp File Reference
#include <gtest/gtest.h>
#include <jlm/rvsdg/bitstring.hpp>
#include <jlm/rvsdg/NodeNormalization.hpp>
#include <jlm/rvsdg/view.hpp>
Include dependency graph for BitstringTests.cpp:

Go to the source code of this file.

Macros

#define ZERO_64
 
#define ONE_64
 
#define MONE_64
 

Functions

 TEST (bitstring, arithmetic_test_bitand)
 
 TEST (bitstring, arithmetic_test_bitashr)
 
 TEST (bitstring, arithmetic_test_bitdifference)
 
 TEST (bitstring, arithmetic_test_bitnegate)
 
 TEST (bitstring, arithmetic_test_bitnot)
 
 TEST (bitstring, arithmetic_test_bitor)
 
 TEST (bitstring, arithmetic_test_bitproduct)
 
 TEST (bitstring, arithmetic_test_bitshiproduct)
 
 TEST (bitstring, arithmetic_test_bitshl)
 
 TEST (bitstring, arithmetic_test_bitshr)
 
 TEST (bitstring, arithmetic_test_bitsmod)
 
 TEST (bitstring, arithmetic_test_bitsquotient)
 
 TEST (bitstring, arithmetic_test_bitsum)
 
 TEST (bitstring, arithmetic_test_bituhiproduct)
 
 TEST (bitstring, arithmetic_test_bitumod)
 
 TEST (bitstring, arithmetic_test_bituquotient)
 
 TEST (bitstring, arithmetic_test_bitxor)
 
static void expect_static_true (jlm::rvsdg::Output *port)
 
static void expect_static_false (jlm::rvsdg::Output *port)
 
 TEST (bitstring, comparison_test_bitequal)
 
 TEST (bitstring, comparison_test_bitnotequal)
 
 TEST (bitstring, comparison_test_bitsgreater)
 
 TEST (bitstring, comparison_test_bitsgreatereq)
 
 TEST (bitstring, comparison_test_bitsless)
 
 TEST (bitstring, comparison_test_bitslesseq)
 
 TEST (bitstring, comparison_test_bitugreater)
 
 TEST (bitstring, comparison_test_bitugreatereq)
 
 TEST (bitstring, bitstring_comparison_test_bituless)
 
 TEST (bitstring, bitstring_comparison_test_bitulesseq)
 
 TEST (bitstring, bitstring_test_constant)
 
 TEST (bitstring, bitstring_test_normalize)
 
static void assert_constant (jlm::rvsdg::Output *bitstr, size_t nbits, const char bits[])
 
 TEST (bitstring, test_reduction)
 
 TEST (bitstring, SliceOfConcatReduction)
 
 TEST (bitstring, ConcatOfSliceReduction)
 
 TEST (bitstring, SliceOfConstant)
 
 TEST (bitstring, SliceOfSlice)
 
 TEST (bitstring, SliceOfFullNode)
 
 TEST (bitstring, SliceOfConcat)
 
 TEST (bitstring, ConcatFlattening)
 
 TEST (bitstring, ConcatWithSingleOperand)
 
 TEST (bitstring, ConcatOfSlices)
 
 TEST (bitstring, ConcatOfConstants)
 
 TEST (bitstring, ConcatCne)
 
 TEST (bitstring, SliceCne)
 
 TEST (bitstring, test_value_representation)
 

Variables

static const char * bs []
 
static std::string bitstring_not []
 
static std::string bitstring_xor [10][10]
 
static std::string bitstring_or [10][10]
 
static std::string bitstring_and [10][10]
 
static char equal [10][10]
 
static char notequal [10][10]
 
static char sgreatereq [10][10]
 
static char sgreater [10][10]
 
static char slesseq [10][10]
 
static char sless [10][10]
 
static char ugreatereq [10][10]
 
static char ugreater [10][10]
 
static char ulesseq [10][10]
 
static char uless [10][10]
 

Macro Definition Documentation

◆ MONE_64

#define MONE_64
Value:
"11111111" \
"11111111" \
"11111111" \
"11111111" \
"11111111" \
"11111111" \
"11111111" \
"11111111"

Definition at line 1103 of file BitstringTests.cpp.

◆ ONE_64

#define ONE_64
Value:
"10000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000"

Definition at line 1094 of file BitstringTests.cpp.

◆ ZERO_64

#define ZERO_64
Value:
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000" \
"00000000"

Definition at line 1085 of file BitstringTests.cpp.

Function Documentation

◆ assert_constant()

static void assert_constant ( jlm::rvsdg::Output bitstr,
size_t  nbits,
const char  bits[] 
)
static

Definition at line 1223 of file BitstringTests.cpp.

◆ expect_static_false()

static void expect_static_false ( jlm::rvsdg::Output port)
inlinestatic

Definition at line 615 of file BitstringTests.cpp.

◆ expect_static_true()

static void expect_static_true ( jlm::rvsdg::Output port)
inlinestatic

Definition at line 605 of file BitstringTests.cpp.

◆ TEST() [1/43]

TEST ( bitstring  ,
arithmetic_test_bitand   
)

Definition at line 13 of file BitstringTests.cpp.

◆ TEST() [2/43]

TEST ( bitstring  ,
arithmetic_test_bitashr   
)

Definition at line 47 of file BitstringTests.cpp.

◆ TEST() [3/43]

TEST ( bitstring  ,
arithmetic_test_bitdifference   
)

Definition at line 101 of file BitstringTests.cpp.

◆ TEST() [4/43]

TEST ( bitstring  ,
arithmetic_test_bitnegate   
)

Definition at line 126 of file BitstringTests.cpp.

◆ TEST() [5/43]

TEST ( bitstring  ,
arithmetic_test_bitnot   
)

Definition at line 163 of file BitstringTests.cpp.

◆ TEST() [6/43]

TEST ( bitstring  ,
arithmetic_test_bitor   
)

Definition at line 200 of file BitstringTests.cpp.

◆ TEST() [7/43]

TEST ( bitstring  ,
arithmetic_test_bitproduct   
)

Definition at line 234 of file BitstringTests.cpp.

◆ TEST() [8/43]

TEST ( bitstring  ,
arithmetic_test_bitshiproduct   
)

Definition at line 268 of file BitstringTests.cpp.

◆ TEST() [9/43]

TEST ( bitstring  ,
arithmetic_test_bitshl   
)

Definition at line 293 of file BitstringTests.cpp.

◆ TEST() [10/43]

TEST ( bitstring  ,
arithmetic_test_bitshr   
)

Definition at line 334 of file BitstringTests.cpp.

◆ TEST() [11/43]

TEST ( bitstring  ,
arithmetic_test_bitsmod   
)

Definition at line 375 of file BitstringTests.cpp.

◆ TEST() [12/43]

TEST ( bitstring  ,
arithmetic_test_bitsquotient   
)

Definition at line 409 of file BitstringTests.cpp.

◆ TEST() [13/43]

TEST ( bitstring  ,
arithmetic_test_bitsum   
)

Definition at line 443 of file BitstringTests.cpp.

◆ TEST() [14/43]

TEST ( bitstring  ,
arithmetic_test_bituhiproduct   
)

Definition at line 477 of file BitstringTests.cpp.

◆ TEST() [15/43]

TEST ( bitstring  ,
arithmetic_test_bitumod   
)

Definition at line 502 of file BitstringTests.cpp.

◆ TEST() [16/43]

TEST ( bitstring  ,
arithmetic_test_bituquotient   
)

Definition at line 536 of file BitstringTests.cpp.

◆ TEST() [17/43]

TEST ( bitstring  ,
arithmetic_test_bitxor   
)

Definition at line 570 of file BitstringTests.cpp.

◆ TEST() [18/43]

TEST ( bitstring  ,
bitstring_comparison_test_bituless   
)

Definition at line 989 of file BitstringTests.cpp.

◆ TEST() [19/43]

TEST ( bitstring  ,
bitstring_comparison_test_bitulesseq   
)

Definition at line 1035 of file BitstringTests.cpp.

◆ TEST() [20/43]

TEST ( bitstring  ,
bitstring_test_constant   
)

Definition at line 1113 of file BitstringTests.cpp.

◆ TEST() [21/43]

TEST ( bitstring  ,
bitstring_test_normalize   
)

Definition at line 1175 of file BitstringTests.cpp.

◆ TEST() [22/43]

TEST ( bitstring  ,
comparison_test_bitequal   
)

Definition at line 624 of file BitstringTests.cpp.

◆ TEST() [23/43]

TEST ( bitstring  ,
comparison_test_bitnotequal   
)

Definition at line 664 of file BitstringTests.cpp.

◆ TEST() [24/43]

TEST ( bitstring  ,
comparison_test_bitsgreater   
)

Definition at line 704 of file BitstringTests.cpp.

◆ TEST() [25/43]

TEST ( bitstring  ,
comparison_test_bitsgreatereq   
)

Definition at line 750 of file BitstringTests.cpp.

◆ TEST() [26/43]

TEST ( bitstring  ,
comparison_test_bitsless   
)

Definition at line 799 of file BitstringTests.cpp.

◆ TEST() [27/43]

TEST ( bitstring  ,
comparison_test_bitslesseq   
)

Definition at line 845 of file BitstringTests.cpp.

◆ TEST() [28/43]

TEST ( bitstring  ,
comparison_test_bitugreater   
)

Definition at line 895 of file BitstringTests.cpp.

◆ TEST() [29/43]

TEST ( bitstring  ,
comparison_test_bitugreatereq   
)

Definition at line 940 of file BitstringTests.cpp.

◆ TEST() [30/43]

TEST ( bitstring  ,
ConcatCne   
)

Definition at line 1593 of file BitstringTests.cpp.

◆ TEST() [31/43]

TEST ( bitstring  ,
ConcatFlattening   
)

Definition at line 1480 of file BitstringTests.cpp.

◆ TEST() [32/43]

TEST ( bitstring  ,
ConcatOfConstants   
)

Definition at line 1568 of file BitstringTests.cpp.

◆ TEST() [33/43]

TEST ( bitstring  ,
ConcatOfSliceReduction   
)

Definition at line 1331 of file BitstringTests.cpp.

◆ TEST() [34/43]

TEST ( bitstring  ,
ConcatOfSlices   
)

Definition at line 1537 of file BitstringTests.cpp.

◆ TEST() [35/43]

TEST ( bitstring  ,
ConcatWithSingleOperand   
)

Definition at line 1511 of file BitstringTests.cpp.

◆ TEST() [36/43]

TEST ( bitstring  ,
SliceCne   
)

Definition at line 1633 of file BitstringTests.cpp.

◆ TEST() [37/43]

TEST ( bitstring  ,
SliceOfConcat   
)

Definition at line 1444 of file BitstringTests.cpp.

◆ TEST() [38/43]

TEST ( bitstring  ,
SliceOfConcatReduction   
)

Definition at line 1285 of file BitstringTests.cpp.

◆ TEST() [39/43]

TEST ( bitstring  ,
SliceOfConstant   
)

Definition at line 1363 of file BitstringTests.cpp.

◆ TEST() [40/43]

TEST ( bitstring  ,
SliceOfFullNode   
)

Definition at line 1419 of file BitstringTests.cpp.

◆ TEST() [41/43]

TEST ( bitstring  ,
SliceOfSlice   
)

Definition at line 1390 of file BitstringTests.cpp.

◆ TEST() [42/43]

TEST ( bitstring  ,
test_reduction   
)

Definition at line 1230 of file BitstringTests.cpp.

◆ TEST() [43/43]

TEST ( bitstring  ,
test_value_representation   
)

Definition at line 2089 of file BitstringTests.cpp.

Variable Documentation

◆ bitstring_and

std::string bitstring_and[10][10]
static

Definition at line 1878 of file BitstringTests.cpp.

◆ bitstring_not

std::string bitstring_not[]
static
Initial value:
= { "11111111", "00000000", "01111111", "10000000", "11110000",
"XXXX1100", "XD110011", "XXXXDDDD", "01XDDX10", "1DDDDDD0" }

Definition at line 1673 of file BitstringTests.cpp.

◆ bitstring_or

std::string bitstring_or[10][10]
static

Definition at line 1777 of file BitstringTests.cpp.

◆ bitstring_xor

std::string bitstring_xor[10][10]
static

Definition at line 1676 of file BitstringTests.cpp.

◆ bs

const char* bs[]
static
Initial value:
= { "00000000", "11111111", "10000000", "01111111", "00001111",
"XXXX0011", "XD001100", "XXXXDDDD", "10XDDX01", "0DDDDDD1" }

Definition at line 1670 of file BitstringTests.cpp.

◆ equal

char equal[10][10]
static
Initial value:
= { { '1', '0', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '0', '1', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '0', '0', '1', '0', '0', '0', '0', 'X', '0', '0' },
{ '0', '0', '0', '1', '0', '0', '0', 'X', '0', 'D' },
{ '0', '0', '0', '0', '1', '0', '0', 'X', '0', 'D' },
{ '0', '0', '0', '0', '0', 'X', '0', 'X', '0', 'X' },
{ '0', '0', '0', '0', '0', '0', 'X', 'X', '0', '0' },
{ 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '0', '0', '0', '0', '0', '0', '0', 'X', 'X', '0' },
{ '0', '0', '0', 'D', 'D', 'X', '0', 'X', '0', 'D' } }

Definition at line 1979 of file BitstringTests.cpp.

◆ notequal

char notequal[10][10]
static
Initial value:
= { { '0', '1', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '1', '0', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '1', '1', '0', '1', '1', '1', '1', 'X', '1', '1' },
{ '1', '1', '1', '0', '1', '1', '1', 'X', '1', 'D' },
{ '1', '1', '1', '1', '0', '1', '1', 'X', '1', 'D' },
{ '1', '1', '1', '1', '1', 'X', '1', 'X', '1', 'X' },
{ '1', '1', '1', '1', '1', '1', 'X', 'X', '1', '1' },
{ 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '1', '1', '1', '1', '1', '1', '1', 'X', 'X', '1' },
{ '1', '1', '1', 'D', 'D', 'X', '1', 'X', '1', 'D' } }

Definition at line 1990 of file BitstringTests.cpp.

◆ sgreater

char sgreater[10][10]
static
Initial value:
= { { '0', '1', '0', '1', '1', '1', '0', 'D', '1', '1' },
{ '0', '0', '0', '1', '1', '1', '0', 'X', '1', '1' },
{ '1', '1', '0', '1', '1', '1', '0', 'X', '1', '1' },
{ '0', '0', '0', '0', '1', '1', '0', 'X', '1', 'D' },
{ '0', '0', '0', '0', '0', '1', '0', 'D', '1', 'D' },
{ '0', '0', '0', '0', '0', 'X', '0', 'X', '1', 'X' },
{ '1', '1', '1', '1', '1', '1', 'X', 'X', '1', '1' },
{ 'X', 'D', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '0', '0', '0', '0', '0', '0', '0', 'X', 'X', 'X' },
{ '0', '0', '0', '0', 'D', 'X', '0', 'X', 'X', 'D' } }

Definition at line 2012 of file BitstringTests.cpp.

◆ sgreatereq

char sgreatereq[10][10]
static
Initial value:
= { { '1', '1', '0', '1', '1', '1', '0', 'X', '1', '1' },
{ '0', '1', '0', '1', '1', '1', '0', 'D', '1', '1' },
{ '1', '1', '1', '1', '1', '1', '0', 'X', '1', '1' },
{ '0', '0', '0', '1', '1', '1', '0', 'X', '1', '1' },
{ '0', '0', '0', '0', '1', '1', '0', 'X', '1', 'D' },
{ '0', '0', '0', '0', '0', 'X', '0', 'X', '1', 'X' },
{ '1', '1', '1', '1', '1', '1', 'X', 'X', '1', '1' },
{ 'D', 'X', 'X', 'X', 'D', 'X', 'X', 'X', 'X', 'X' },
{ '0', '0', '0', '0', '0', '0', '0', 'X', 'X', 'X' },
{ '0', '0', '0', 'D', 'D', 'X', '0', 'X', 'X', 'D' } }

Definition at line 2001 of file BitstringTests.cpp.

◆ sless

char sless[10][10]
static
Initial value:
= { { '0', '0', '1', '0', '0', '0', '1', 'X', '0', '0' },
{ '1', '0', '1', '0', '0', '0', '1', 'D', '0', '0' },
{ '0', '0', '0', '0', '0', '0', '1', 'X', '0', '0' },
{ '1', '1', '1', '0', '0', '0', '1', 'X', '0', '0' },
{ '1', '1', '1', '1', '0', '0', '1', 'X', '0', 'D' },
{ '1', '1', '1', '1', '1', 'X', '1', 'X', '0', 'X' },
{ '0', '0', '0', '0', '0', '0', 'X', 'X', '0', '0' },
{ 'D', 'X', 'X', 'X', 'D', 'X', 'X', 'X', 'X', 'X' },
{ '1', '1', '1', '1', '1', '1', '1', 'X', 'X', 'X' },
{ '1', '1', '1', 'D', 'D', 'X', '1', 'X', 'X', 'D' } }

Definition at line 2034 of file BitstringTests.cpp.

◆ slesseq

char slesseq[10][10]
static
Initial value:
= { { '1', '0', '1', '0', '0', '0', '1', 'D', '0', '0' },
{ '1', '1', '1', '0', '0', '0', '1', 'X', '0', '0' },
{ '0', '0', '1', '0', '0', '0', '1', 'X', '0', '0' },
{ '1', '1', '1', '1', '0', '0', '1', 'X', '0', 'D' },
{ '1', '1', '1', '1', '1', '0', '1', 'D', '0', 'D' },
{ '1', '1', '1', '1', '1', 'X', '1', 'X', '0', 'X' },
{ '0', '0', '0', '0', '0', '0', 'X', 'X', '0', '0' },
{ 'X', 'D', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '1', '1', '1', '1', '1', '1', '1', 'X', 'X', 'X' },
{ '1', '1', '1', '1', 'D', 'X', '1', 'X', 'X', 'D' } }

Definition at line 2023 of file BitstringTests.cpp.

◆ ugreater

char ugreater[10][10]
static
Initial value:
= { { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' },
{ '1', '0', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '1', '0', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '1', '0', '1', '0', '1', '1', '1', 'X', '1', 'D' },
{ '1', '0', '1', '0', '0', '1', '1', 'D', '1', 'D' },
{ '1', '0', '1', '0', '0', 'X', '1', 'X', '1', 'X' },
{ '1', '0', '1', '0', '0', '0', 'X', 'X', '0', '0' },
{ 'X', '0', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '1', '0', '1', '0', '0', '0', '1', 'X', 'X', 'X' },
{ '1', '0', '1', '0', 'D', 'X', '1', 'X', 'X', 'D' } }

Definition at line 2056 of file BitstringTests.cpp.

◆ ugreatereq

char ugreatereq[10][10]
static
Initial value:
= { { '1', '0', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '1', '1', '1', '1', '1', '1', '1', '1', '1', '1' },
{ '1', '0', '1', '0', '0', '0', '0', 'X', '0', '0' },
{ '1', '0', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '1', '0', '1', '0', '1', '1', '1', 'X', '1', 'D' },
{ '1', '0', '1', '0', '0', 'X', '1', 'X', '1', 'X' },
{ '1', '0', '1', '0', '0', '0', 'X', 'X', '0', '0' },
{ '1', 'X', 'X', 'X', 'D', 'X', 'X', 'X', 'X', 'X' },
{ '1', '0', '1', '0', '0', '0', '1', 'X', 'X', 'X' },
{ '1', '0', '1', 'D', 'D', 'X', '1', 'X', 'X', 'D' } }

Definition at line 2045 of file BitstringTests.cpp.

◆ uless

char uless[10][10]
static
Initial value:
= { { '0', '1', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' },
{ '0', '1', '0', '1', '1', '1', '1', 'X', '1', '1' },
{ '0', '1', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '0', '1', '0', '1', '0', '0', '0', 'X', '0', 'D' },
{ '0', '1', '0', '1', '1', 'X', '0', 'X', '0', 'X' },
{ '0', '1', '0', '1', '1', '1', 'X', 'X', '1', '1' },
{ '0', 'X', 'X', 'X', 'D', 'X', 'X', 'X', 'X', 'X' },
{ '0', '1', '0', '1', '1', '1', '0', 'X', 'X', 'X' },
{ '0', '1', '0', 'D', 'D', 'X', '0', 'X', 'X', 'D' } }

Definition at line 2078 of file BitstringTests.cpp.

◆ ulesseq

char ulesseq[10][10]
static
Initial value:
= { { '1', '1', '1', '1', '1', '1', '1', '1', '1', '1' },
{ '0', '1', '0', '0', '0', '0', '0', 'X', '0', '0' },
{ '0', '1', '1', '1', '1', '1', '1', 'X', '1', '1' },
{ '0', '1', '0', '1', '0', '0', '0', 'X', '0', 'D' },
{ '0', '1', '0', '1', '1', '0', '0', 'D', '0', 'D' },
{ '0', '1', '0', '1', '1', 'X', '0', 'X', '0', 'X' },
{ '0', '1', '0', '1', '1', '1', 'X', 'X', '1', '1' },
{ 'X', '1', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' },
{ '0', '1', '0', '1', '1', '1', '0', 'X', 'X', 'X' },
{ '0', '1', '0', '1', 'D', 'X', '0', 'X', 'X', 'D' } }

Definition at line 2067 of file BitstringTests.cpp.