← 목록
기타 2026-07-03 1KB 읽기 2분

요청: ccp-x86-shani

  • 날짜: 2026-07-03 11:08:48
  • 작업 경로: /Users/ef/crowny-compressor

요청 본문

src/ccp.c에 x86_64 SHA-NI 하드웨어 가속 경로 추가 (런타임 디스패치 + 자가검증). arm64 회귀 없음 필수.

관련 산출

(클로드가 작업 결과를 이어 기록)

결과

변경 위치

/Users/ef/crowny-compressor/src/ccp.c — 103번째 줄 직후에 #elif defined(__x86_64__) && !defined(CCP_NO_SHANI) 분기 추가.

변경 요약

  • sha_transform_hw(uint32_t st[8], const uint8_t blk[64])__attribute__((target("sha,sse4.1,ssse3"))) 부착, Jeffrey Walton 공개도메인 sha256_process_x86 루틴 구현 (16×4라운드, _mm_sha256rnds2_epu32 + sha256msg1/msg2 + alignr).
  • g_sha_hw 전역 플래그 + __attribute__((constructor)) sha_x86_init()__builtin_cpu_supports("sha") AND HW==스칼라 자가검증 일치 시에만 1.
  • sha_transform() 런타임 분기 함수 — g_sha_hw 기준 HW/스칼라 선택.

컴파일 결과

  • arm64 native: 경고 0, ./ccp t → L1/L5/L9 PASS
  • cc -arch x86_64 -O2 -pthread → exit:0 (경고/에러 없음)
  • cc -arch x86_64 -O2 -DCCP_NO_SHANI -pthread → exit:0
  • Rosetta 실행: 스칼라 폴백 정상 동작 (SHA-NI 미지원 → g_sha_hw=0, SIGILL 없음)

크라우니코드 패턴

x86_sha_ni_runtime_dispatch — 학습DB 등록 완료