Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

106 lines
1.8 KiB
C

#define WITH_TARGET_WORD_MSB 0
#define WITH_TARGET_WORD_BITSIZE 64
#define WITH_HOST_WORD_BITSIZE (sizeof (int) * 8)
#define WITH_TARGET_BYTE_ORDER BIG_ENDIAN /* does not matter */
#define ASSERT(EXPRESSION) \
{ \
if (!(EXPRESSION)) { \
fprintf (stderr, "%s:%d: assertion failed - %s\n", \
__FILE__, __LINE__, #EXPRESSION); \
abort (); \
} \
}
#define SIM_BITS_INLINE (INCLUDE_MODULE | INCLUDED_BY_MODULE)
#include <stdlib.h>
#include <string.h>
#define PACKAGE "sim"
#include "sim-basics.h"
#include "sim-alu.h"
#include <stdio.h>
typedef struct {
char *op;
uint64_t arg;
} alu_op;
typedef struct {
uint64_t begin;
alu_op ops[4];
uint64_t result;
int carry_borrow;
int overflow;
} alu_test;
#define MAX_INT8 UNSIGNED64 (127)
#define MIN_INT8 UNSIGNED64 (128)
#define MAX_INT16 UNSIGNED64 (32767)
#define MIN_INT16 UNSIGNED64 (32768)
#define MAX_INT32 UNSIGNED64 (0x7fffffff)
#define MIN_INT32 UNSIGNED64 (0x80000000)
#define MAX_INT64 UNSIGNED64 (0x7fffffffffffffff)
#define MIN_INT64 UNSIGNED64 (0x8000000000000000)
static void
print_hex (uint64_t val, int nr_bits)
{
switch (nr_bits)
{
case 8:
printf ("0x%02lx", (long) (uint8_t) (val));
break;
case 16:
printf ("0x%04lx", (long) (uint16_t) (val));
break;
case 32:
printf ("0x%08lx", (long) (uint32_t) (val));
break;
case 64:
printf ("0x%016llx", (long long) (uint64_t) (val));
break;
default:
abort ();
}
}
int errors = 0;
#define N 8
#include "alu-n-tst.h"
#undef N
#define N 16
#include "alu-n-tst.h"
#undef N
#define N 32
#include "alu-n-tst.h"
#undef N
#define N 64
#include "alu-n-tst.h"
#undef N
int
main ()
{
do_alu_8_tests ();
do_alu_16_tests ();
do_alu_32_tests ();
do_alu_64_tests ();
return (errors != 0);
}