Commit e73ee859 by Karl Schimpf

Fix Subzero binary instruction to allow optional flags argument.

This CL fixes pnacl-sz to handle smoothnacl.pexe. BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4364 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1831043002 .
parent 267f2bf9
......@@ -2198,8 +2198,12 @@ void FunctionParser::ProcessRecord() {
return;
}
case naclbitc::FUNC_CODE_INST_BINOP: {
// BINOP: [opval, opval, opcode]
if (!isValidRecordSize(3, "binop"))
// Note: Old bitcode files may have an additional 'flags' operand, which is
// ignored.
// BINOP: [opval, opval, opcode, [flags]]
if (!isValidRecordSizeInRange(3, 4, "binop"))
return;
Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex);
Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex);
......
65535,8,2;
1,1;
65535,17,2;
1,3;
7,32;
21,0,0,0,0;
2;
65534;
8,1,0,0,3;
65535,19,2;
5,0;
65534;
65535,12,4;
1,1;
2,2,1,0;
10,1;
65534;
65534;
65535,8,2;
1,1;
65535,17,2;
1,3;
7,32;
21,0,0,0,0;
2;
65534;
8,1,0,0,3;
65535,19,2;
5,0;
65534;
65535,12,4;
1,1;
2,2,1,0,5169;
10,1;
65534;
65534;
; Test if we recognize both the old and the new forms of a binary instruction.
; REQUIRES: no_minimal_build
; Checks that the new form of binary add (without flags argument) works.
; RUN: %pnacl_sz -verbose inst,global_init -notranslate \
; RUN: -threads=0 -bitcode-as-text %p/Inputs/binop-newform.tbc \
; RUN: | FileCheck %s
; Checks that the old form of binary add (with flags argument) works.
; RUN: %pnacl_sz -verbose inst,global_init -notranslate \
; RUN: -threads=0 -bitcode-as-text %p/Inputs/binop-oldform.tbc \
; RUN: | FileCheck %s
; CHECK: define internal i32 @Function(i32 %__0, i32 %__1) {
; CHECK: __0:
; CHECK: %__2 = add i32 %__0, %__1
; CHECK: ret i32 %__2
; CHECK: }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment