)]}'
{
  "commit": "ffc5227ac2e198d1e88d7c686e18262a0bc06c61",
  "tree": "2f14f3cc345d379b4240899331d7dc734f81dd31",
  "parents": [
    "62a6880758d410758f43b08cad9fa9d159ec8583"
  ],
  "author": {
    "name": "Wilco Dijkstra",
    "email": "wilco.dijkstra@arm.com",
    "time": "Tue Aug 25 11:52:55 2026 +0000"
  },
  "committer": {
    "name": "Wilco Dijkstra",
    "email": "wilco.dijkstra@arm.com",
    "time": "Wed Sep 02 16:16:52 2026 +0000"
  },
  "message": "libcpp: Optimize Arm search_line_fast\n\nThe existing Arm search_line_fast is ancient and not well optimized.\nOptimize it for typical inputs (short lines) - what matters is to quickly\nget the match result for the first few vectors with minimal initialization\noverhead.  We simply loop until a match is found even if the input pointer\nis unaligned or close to the end.  Since this may overread, it relies on\n*end containing a match and CPP_BUFFER_PADDING \u003e\u003d 16.\n\nLookup the low 3 bits of each character using 2 64-bit TBLs and compare\nthe 128-bit result with the original input.  The lookup table contains\nthe 4 search characters at entries MOD 8, thus if tab[ch % 8] \u003d\u003d ch, we\nhave found a match.  This works because the low 3 bits of the search\ncharacters are unique in ASCII, allowing the use of TBL.  Use a special\nvalue in tab[0] to avoid matching NUL.\n\nThe optimized sequence is less than a third of the old code:\n\n\tvmov.i8 q12, #7  @ v16qi\n\tvldr    d22, .L29\n.L25:\n\tvld1.8  {d18-d19}, [r0]!\n\tvand    q10, q9, q12\n\tvtbl.8  d16, {d22}, d20\n\tvtbl.8  d17, {d22}, d21\n\tvceq.i8 q8, q8, q9\n\tvaddhn.i16      d16, q8, q8\n\tvmov    r2, r3, d16     @ int\n\torrs    r1, r2, r3\n\tbeq     .L25\n\tcmp     r2, #0\n\trbiteq  r2, r3\n\trbitne  r2, r2\n\tclzeq   r2, r2\n\tclzne   r2, r2\n\taddeq   r2, r2, #32\n\tsub     r2, r2, #61\n\tadd     r0, r0, r2, asr #2\n\tbx      lr\n\nPerformance is significantly better as a result: on a huge trace that replays\nthe calls from libcpp it is ~24% faster on Neoverse N1.\n\nlibcpp/ChangeLog:\n\n\t* lex.cc (search_line_fast): Optimized Arm implementation.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0e4d29a2950a45b9e43f4673bf69394134264660",
      "old_mode": 33188,
      "old_path": "libcpp/lex.cc",
      "new_id": "3307d93622a0796990826e8b6c73b4ef82ca30b4",
      "new_mode": 33188,
      "new_path": "libcpp/lex.cc"
    }
  ]
}
