8000 Fails to reject bitwise operation on arbitrary precision integers · Issue #5300 · p4lang/p4c · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Fails to reject bitwise operation on arbitrary precision integers #5300
Open
@jaehyun1ee

Description

@jaehyun1ee

The P4 Spec defines bitwise XOR operation on fixed-width integers, but not on arbitrary precision integers.

8.9. Operations on arbitrary-precision integers
Note: bitwise-operations (|, &, ^, ~) are not defined on expressions of type int.

However, the below program is not rejected by p4test.

bool f(int a, int b) {
   return a ^ b == 0; // HERE
}
extern void g(in bool t);

control C(int a, int b);
package P(C c);
control CImpl(int a, int b) {
  apply {
    bool local = f(a, b);
    g(local);
  }
}
P(CImpl ()) main;

Function f performs bitwise XOR on two arbitrary precision integers, a and b.
Below is the output of the final pass (MidEnd_50_DumpPipe) when given --top4 argument:

extern void g(in bool t);
control C(int a, int b);
package P(C c);
control CImpl(int a, int b) {
    @hidden action bxorintrep11() {
        g(a ^ b == 0); // HERE
    }
    @hidden table tbl_bxorintrep11 {
        actions = {
            bxorintrep11();
        }
        const default_action = bxorintrep11();
    }
    apply {
        tbl_bxorintrep11.apply();
    }
}

P(CImpl()) main;

i.e., the operation still exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4-specTopics related to the P4 specification (https://github.com/p4lang/p4-spec/).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0