Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLHD] Add extract field operations #35

Merged
merged 3 commits into from
Jul 16, 2020

Conversation

maerhart
Copy link
Member

  • Add operations to statically and dynamically extract an element from
    a vector or tuple
  • They can also operate on signals by returning an alias signal to the
    specified element of the underlying type of the target signal, this
    means they don't perform any kind of probing like the llhd.prb
    instruction

* Add operations to statically and dynamically extract an element from
a vector or tuple
* They can also operate on signals by returning an alias signal to the
specified element of the underlying type of the target signal, this
means they don't perform any kind of probing like the llhd.prb
instruction
Copy link
Collaborator

@lattner lattner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to me in a quick glance, but I didn't do a detailed review

@@ -101,3 +101,118 @@ def LLHD_DextsOp : LLHD_Op<"dexts", [
unsigned getTargetWidth() { return getLLHDTypeWidth(target().getType()); }
}];
}

def LLHD_ExtfOp : LLHD_Op<"extf", [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer complete words. IS this "Extend Float?" "Extract field?" "External foobar?" "Example Tensorflow?"

PredOpTrait<"'index' has to be smaller than the 'target' size",
CPred<"$index.cast<IntegerAttr>().getInt() < getTargetWidth()">>,
TypesMatchWith<"'result' type has to match type at 'index' of 'target', in "
"case 'target' is a singal, consider the underlying types of the 'target'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

singal -> signal

NoSideEffect,
PredOpTrait<"'index' has to be smaller than the 'target' size",
CPred<"$index.cast<IntegerAttr>().getInt() < getTargetWidth()">>,
TypesMatchWith<"'result' type has to match type at 'index' of 'target', in "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems awkwardly worded to me. The description doesn't quite seem to match the predicate?

"getElementTypeAtIndex($index.cast<IntegerAttr>().getInt())) "
": getElementTypeAtIndex($index.cast<IntegerAttr>().getInt()))">
]> {
let summary = "Extract an element from a vector or tuple";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or a signal with with vector or tuple type?

}];
}

def LLHD_DextfOp : LLHD_Op<"dextf", [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, it's random sequence of letters op!

* llhd.extf -> llhd.extract_element
* llhd.dextf -> llhd.dyn_extract_element
@maerhart
Copy link
Member Author

@stephenneuendorffer Thanks for your review! I renamed llhd.extf -> llhd.extract_element and llhd.dextf -> llhd.dyn_extract_element.
I'll also rename the already existing insert and extract operations in another PR as follows:
llhd.exts -> llhd.extract_slice
llhd.dexts -> llhd.dyn_extract_slice
llhd.inss -> llhd.insert_slice
llhd.insf -> llhd.insert_element
Or does someone have a suggestion for another (better) naming scheme?

@rodonisi
Copy link
Contributor

@stephenneuendorffer Thanks for your review! I renamed llhd.extf -> llhd.extract_element and llhd.dextf -> llhd.dyn_extract_element.
I'll also rename the already existing insert and extract operations in another PR as follows:
llhd.exts -> llhd.extract_slice
llhd.dexts -> llhd.dyn_extract_slice
llhd.inss -> llhd.insert_slice
llhd.insf -> llhd.insert_element
Or does someone have a suggestion for another (better) naming scheme?

Sounds good I think.

@maerhart maerhart merged commit 7e35554 into llvm:master Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants