Skip to content

Commit

Permalink
Add shifts test
Browse files Browse the repository at this point in the history
  • Loading branch information
leadpogrommer committed Apr 15, 2024
1 parent a7c2396 commit 8c001b1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions llvm/test_cdm/src/shifts.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@


typedef unsigned int uint;
typedef signed char schar;
typedef unsigned char uchar;


#define DS(type) \
volatile int s1_##type; \
volatile type s2_##type; \
volatile type s3_##type; \
volatile type s4_##type; \
__attribute__((noinline)) \
void do_shifts_##type(type a, type b){ \
s1_##type = a << 3; \
s2_##type = b << 15; \
s3_##type = a >> 4; \
s4_##type = b >> 14; \
}


DS(int)
DS(uint)
DS(schar)
DS(uchar)

int main(){
do_shifts_int(-228, -1337);
do_shifts_uint(228, 1337);
do_shifts_schar(-57, -99);
do_shifts_uchar(211, 122);
}

0 comments on commit 8c001b1

Please sign in to comment.