Skip to content

Commit

Permalink
Fix SSE families
Browse files Browse the repository at this point in the history
The previous commit actually uses SSSE3 instruction.
  • Loading branch information
ngrodzitski committed Oct 11, 2023
1 parent 5b7c3a9 commit 7602ea1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/implementation/c/compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type WrappedNode = frontend.IWrap<frontend.node.Node>;

// The SSE versions in use with the generator.
export enum SseFamily {
SSE2 = 'SSE2',
SSSE3 = 'SSSE3',
SSE4_2 = 'SSE4_2',
}

Expand Down
12 changes: 6 additions & 6 deletions src/implementation/c/node/table-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TableLookup extends Node<frontend.node.TableLookup> {
out.push('}');
}

private buildSSE2(out: string[]): boolean {
private buildSSSE3(out: string[]): boolean {
// return false;
const ctx = this.compilation;

Expand Down Expand Up @@ -99,10 +99,10 @@ export class TableLookup extends Node<frontend.node.TableLookup> {
return false;
}

const blob1 = ctx.blob(Buffer.from(result[0]), SSE_ALIGNMENT, SseFamily.SSE2);
const blob2 = ctx.blob(Buffer.from(result[1]), SSE_ALIGNMENT, SseFamily.SSE2);
const blob1 = ctx.blob(Buffer.from(result[0]), SSE_ALIGNMENT, SseFamily.SSSE3);
const blob2 = ctx.blob(Buffer.from(result[1]), SSE_ALIGNMENT, SseFamily.SSSE3);

out.push('#ifdef __SSE2__');
out.push('#ifdef __SSSE3__');
out.push(`if (${ctx.endPosArg()} - ${ctx.posArg()} >= 16) {`);
out.push(' int index;');
out.push(' __m128i lut_tlo;');
Expand Down Expand Up @@ -141,7 +141,7 @@ export class TableLookup extends Node<frontend.node.TableLookup> {
});
ctx.indent(out, tmp, ' ');
out.push('}');
out.push('#endif /* __SSE2__ */');
out.push('#endif /* __SSSE3__ */');
return true;
}

Expand Down Expand Up @@ -248,7 +248,7 @@ export class TableLookup extends Node<frontend.node.TableLookup> {
}

private buildSSE(out: string[]): boolean {
if (this.buildSSE2(out)){
if (this.buildSSSE3(out)){
return true;
}
return this.buildSSE42(out);
Expand Down

0 comments on commit 7602ea1

Please sign in to comment.