File size: 2,242 Bytes
f25167e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
  "name": "reference_loop_034",
  "definition": "loop_034",
  "dataset": "simd-loop",
  "author": "reference",
  "spec": {
    "language": "cpp",
    "target_hardware": [
      "aarch64"
    ],
    "entry_point": "kernel.cpp::inner_loop_034",
    "dependencies": [],
    "isa_features": [],
    "compile_flags": [
      "-O2",
      "-std=c++14",
      "-fno-vectorize",
      "-fno-slp-vectorize"
    ],
    "link_flags": []
  },
  "sources": [
    {
      "path": "loop_034.h",
      "content": "// Auto-generated by scripts/gen_simd_loop_harness.py \u2014 do not hand-edit.\n#pragma once\n#include <stdint.h>\n\nstruct loop_034_data {\n    uint8_t *a;\n    uint8_t *b;\n    uint8_t *lmt;\n    uint32_t checksum;\n};\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nint armbench_entry_loop_034(void *a, void *b, int64_t n, void *res_out);\n#ifdef __cplusplus\n}\n#endif\n"
    },
    {
      "path": "loop_034.cpp",
      "content": "// Auto-generated by scripts/gen_simd_loop_harness.py \u2014 do not hand-edit.\n#include \"loop_034.h\"\n#include <stdint.h>\n\nextern \"C\" void inner_loop_034(struct loop_034_data *data);\n\nextern \"C\" int armbench_entry_loop_034(void *a, void *b, int64_t n, void *res_out) {\n    struct loop_034_data _kd;\n    _kd.a = static_cast<uint8_t *>(a);\n    _kd.b = static_cast<uint8_t *>(b);\n    _kd.lmt = static_cast<uint8_t *>(a) + n;\n    _kd.checksum = 0;\n    inner_loop_034(&_kd);\n    *static_cast<uint32_t *>(res_out) = _kd.checksum;\n    return 0;\n}\n"
    },
    {
      "path": "kernel.cpp",
      "content": "#include \"loop_034.h\"\n#include <cstring>\n#include <stdint.h>\n\nextern \"C\" void inner_loop_034(struct loop_034_data *data) {\n    uint8_t *p1 = data->a; uint8_t *p2 = data->b; uint8_t *lmt = data->lmt;\n    uint32_t res = 0, cnt = 0; int length = 13;\n    while (p1 < lmt) {\n        int64_t r = strcmp((const char *)p1, (const char *)p2);\n        uint32_t cmp = 1; if (r > 0) cmp = 2; if (r < 0) cmp = 3;\n        res += cnt * cmp; p1 += length; p2 += length; cnt++;\n        length = 3 + (length + 11) % 43;\n    }\n    data->checksum = res;\n}\n"
    }
  ],
  "description": "Scalar reference (auto-vectorization disabled) for loop_034. Baseline for speedup measurement."
}