[llvm-dev] infer correct types from the pattern

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 30 14:50:56 PDT 2016


On 3/30/2016 4:42 PM, Rail Shafigulin via llvm-dev wrote:
> i'm getting a
>
> Could not infer all types in pattern!
>
> error in my backend. it is happening on the following instruction:
>
> VGETITEM:  (set GPR:{i32:f32}:$rD, (extractelt:{i32:f32}
> VR:{v4i32:v4f32}:$rA, GPR:i32:$rB)).
>
> how do i make it use appropriate types? in other words if it is f32 then
> use v4v32 and if it is i32 then use v4f32. i'm not sure even where to start?

You can use a cast, and force one type in the pattern, then use the 
other one in a Pat:

def VGETITEM:
   [(set GPR:$rD, (extractelt (v4i32 VR:$rA), GPR:$rB))]

def: Pat<(extractelt (v4f32 VR:$rA), GPR:$rB)),
          (VGETITEM VR:$rA, GPR:$rB)>;

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list