File size: 2,290 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_114",
  "definition": "loop_114",
  "dataset": "simd-loop",
  "author": "reference",
  "spec": {
    "language": "cpp",
    "target_hardware": [
      "aarch64"
    ],
    "entry_point": "kernel.cpp::inner_loop_114",
    "dependencies": [],
    "isa_features": [],
    "compile_flags": [
      "-O2",
      "-std=c++14",
      "-fno-vectorize",
      "-fno-slp-vectorize"
    ],
    "link_flags": []
  },
  "sources": [
    {
      "path": "loop_114.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_114_data {\n    int16_t *data;\n    int16_t *res;\n    int32_t n;\n    int32_t lags;\n    int16_t scale;\n};\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nint armbench_entry_loop_114(void *data, int64_t n, int64_t lags, int64_t scale, void *res_out);\n#ifdef __cplusplus\n}\n#endif\n"
    },
    {
      "path": "loop_114.cpp",
      "content": "// Auto-generated by scripts/gen_simd_loop_harness.py \u2014 do not hand-edit.\n#include \"loop_114.h\"\n#include <stdint.h>\n\nextern \"C\" void inner_loop_114(struct loop_114_data *data);\n\nextern \"C\" int armbench_entry_loop_114(void *data, int64_t n, int64_t lags, int64_t scale, void *res_out) {\n    struct loop_114_data _kd;\n    _kd.data = static_cast<int16_t *>(data);\n    _kd.res = static_cast<int16_t *>(res_out);\n    _kd.n = static_cast<int32_t>(n);\n    _kd.lags = static_cast<int32_t>(lags);\n    _kd.scale = static_cast<int16_t>(scale);\n    inner_loop_114(&_kd);\n    return 0;\n}\n"
    },
    {
      "path": "kernel.cpp",
      "content": "#include \"loop_114.h\"\n#include <stdint.h>\n\nextern \"C\" void inner_loop_114(struct loop_114_data *data) {\n    int16_t *d = data->data;\n    int16_t *res = data->res;\n    int32_t n = data->n;\n    int32_t lags = data->lags;\n    int16_t scale = data->scale;\n    for (int lag = 0; lag < lags; lag++) {\n        int32_t acc = 0;\n        int lmt = n - lag;\n        for (int i = 0; i < lmt; i++)\n            acc += ((int32_t)d[i] * (int32_t)d[i + lag]) >> scale;\n        res[lag] = (int16_t)(acc >> 16);\n    }\n}\n"
    }
  ],
  "description": "Scalar reference (auto-vectorization disabled) for loop_114. Baseline for speedup measurement."
}