memset.c
Megabyte-scale size constant in source
SHA-25666947ab1c33b2903603a1ef19111ff4156e64adf3c6df54cbb4d9e17d29cb65a
MaleculeH(Mg)
Evidence
2:16… mark.
3 *
4 * Copyright (c) 2021, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6 */
7
8#define _GNU_SOURCE
9#include <stdint.h>
10#include <stdio.h>
11#include <string.h>
12#include <assert.h>
13#include "stringlib.h"
14#include "benchlib.h"
15
16#define ITERS 5000
17#define ITERS2 20000000
18#define ITERS3 1000000
19#define NUM_TESTS 16384
20#define MIN_SIZE 32768
21#define MAX_SIZE (1024 * 1024)
22
23static uint8_t a[MAX_SIZE + 4096] __attribute__((__aligned__(4096)));
⋯4 lines
42:6… c uint8_t len_arr[SIZE_NUM];
43
44/* Frequency data for memset sizes up to 4096 based on SPEC2017. */
45static freq_data_t memset_len_freq[] =
46{
47{40,288 …
107:14… l = 0;
108 /* Create a random set of memsets with the given size and alignment
109 distributions. */
110 for (int i = 0; i < NUM_TESTS; i++)
111 {
112 test_arr[i] …